github.com/walkingsparrow/docker@v1.4.2-0.20151218153551-b708a2249bfa/api/client/lib/container_restart.go (about)

     1  package lib
     2  
     3  import (
     4  	"net/url"
     5  	"strconv"
     6  )
     7  
     8  // ContainerRestart stops and starts a container again.
     9  // It makes the daemon to wait for the container to be up again for
    10  // a specific amount of time, given the timeout.
    11  func (cli *Client) ContainerRestart(containerID string, timeout int) error {
    12  	query := url.Values{}
    13  	query.Set("t", strconv.Itoa(timeout))
    14  	resp, err := cli.post("/containers/"+containerID+"/restart", query, nil, nil)
    15  	ensureReaderClosed(resp)
    16  	return err
    17  }