2015-12-04 12:44:12 -05:00
|
|
|
package lib
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/url"
|
|
|
|
"strconv"
|
|
|
|
)
|
|
|
|
|
|
|
|
// ContainerRestart stops and starts a container again.
|
|
|
|
// It makes the daemon to wait for the container to be up again for
|
|
|
|
// a specific amount of time, given the timeout.
|
|
|
|
func (cli *Client) ContainerRestart(containerID string, timeout int) error {
|
2015-12-04 21:06:12 -05:00
|
|
|
query := url.Values{}
|
2015-12-04 12:44:12 -05:00
|
|
|
query.Set("t", strconv.Itoa(timeout))
|
2015-12-05 20:28:36 -05:00
|
|
|
resp, err := cli.post("/containers/"+containerID+"/restart", query, nil, nil)
|
2015-12-04 12:44:12 -05:00
|
|
|
ensureReaderClosed(resp)
|
|
|
|
return err
|
|
|
|
}
|