Deprecate --restart on the daemon
Signed-off-by: Michael Crosby <michael@docker.com>
This commit is contained in:
parent
73ced63680
commit
25c519e829
5 changed files with 13 additions and 17 deletions
|
@ -45,7 +45,7 @@ type Config struct {
|
|||
func (config *Config) InstallFlags() {
|
||||
flag.StringVar(&config.Pidfile, []string{"p", "-pidfile"}, "/var/run/docker.pid", "Path to use for daemon PID file")
|
||||
flag.StringVar(&config.Root, []string{"g", "-graph"}, "/var/lib/docker", "Path to use as the root of the Docker runtime")
|
||||
flag.BoolVar(&config.AutoRestart, []string{"r", "-restart"}, true, "Restart previously running containers")
|
||||
flag.BoolVar(&config.AutoRestart, []string{"#r", "#-restart"}, true, "--restart on the daemon has been deprecated infavor of --restart policies on docker run")
|
||||
flag.BoolVar(&config.EnableIptables, []string{"#iptables", "-iptables"}, true, "Enable Docker's addition of iptables rules")
|
||||
flag.BoolVar(&config.EnableIpForward, []string{"#ip-forward", "-ip-forward"}, true, "Enable net.ipv4.ip_forward")
|
||||
flag.StringVar(&config.BridgeIP, []string{"#bip", "-bip"}, "", "Use this CIDR notation address for the network bridge's IP, not compatible with -b")
|
||||
|
|
|
@ -372,10 +372,10 @@ func (daemon *Daemon) restore() error {
|
|||
for _, container := range registeredContainers {
|
||||
if container.hostConfig.RestartPolicy.Name == "always" ||
|
||||
(container.hostConfig.RestartPolicy.Name == "on-failure" && container.State.ExitCode != 0) {
|
||||
utils.Debugf("Starting container %s", container.ID)
|
||||
log.Debugf("Starting container %s", container.ID)
|
||||
|
||||
if err := container.Start(); err != nil {
|
||||
utils.Debugf("Failed to start container %s: %s", container.ID, err)
|
||||
log.Debugf("Failed to start container %s: %s", container.ID, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/docker/docker/daemon/execdriver"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
"github.com/docker/docker/runconfig"
|
||||
"github.com/docker/docker/utils"
|
||||
)
|
||||
|
||||
const defaultTimeIncrement = 100
|
||||
|
@ -88,7 +88,7 @@ func (m *containerMonitor) Close() error {
|
|||
// because they share same runconfig and change image. Must be fixed
|
||||
// in builder/builder.go
|
||||
if err := m.container.toDisk(); err != nil {
|
||||
utils.Errorf("Error dumping container %s state to disk: %s\n", m.container.ID, err)
|
||||
log.Errorf("Error dumping container %s state to disk: %s\n", m.container.ID, err)
|
||||
|
||||
return err
|
||||
}
|
||||
|
@ -127,13 +127,13 @@ func (m *containerMonitor) Start() error {
|
|||
if exitStatus, err = m.container.daemon.Run(m.container, pipes, m.callback); err != nil {
|
||||
// if we receive an internal error from the initial start of a container then lets
|
||||
// return it instead of entering the restart loop
|
||||
if m.container.RestartCount == 1 {
|
||||
if m.container.RestartCount == 0 {
|
||||
m.resetContainer()
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
utils.Errorf("Error running container: %s", err)
|
||||
log.Errorf("Error running container: %s", err)
|
||||
}
|
||||
|
||||
m.resetMonitor(err == nil && exitStatus == 0)
|
||||
|
@ -220,7 +220,7 @@ func (m *containerMonitor) shouldRestart(exitStatus int) bool {
|
|||
case "on-failure":
|
||||
// the default value of 0 for MaximumRetryCount means that we will not enforce a maximum count
|
||||
if max := m.restartPolicy.MaximumRetryCount; max != 0 && m.failureCount >= max {
|
||||
utils.Debugf("stopping restart of container %s because maximum failure could of %d has been reached", max)
|
||||
log.Debugf("stopping restart of container %s because maximum failure could of %d has been reached", max)
|
||||
return false
|
||||
}
|
||||
|
||||
|
@ -251,7 +251,7 @@ func (m *containerMonitor) callback(command *execdriver.Command) {
|
|||
}
|
||||
|
||||
if err := m.container.ToDisk(); err != nil {
|
||||
utils.Debugf("%s", err)
|
||||
log.Debugf("%s", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -262,21 +262,21 @@ func (m *containerMonitor) resetContainer() {
|
|||
|
||||
if container.Config.OpenStdin {
|
||||
if err := container.stdin.Close(); err != nil {
|
||||
utils.Errorf("%s: Error close stdin: %s", container.ID, err)
|
||||
log.Errorf("%s: Error close stdin: %s", container.ID, err)
|
||||
}
|
||||
}
|
||||
|
||||
if err := container.stdout.Clean(); err != nil {
|
||||
utils.Errorf("%s: Error close stdout: %s", container.ID, err)
|
||||
log.Errorf("%s: Error close stdout: %s", container.ID, err)
|
||||
}
|
||||
|
||||
if err := container.stderr.Clean(); err != nil {
|
||||
utils.Errorf("%s: Error close stderr: %s", container.ID, err)
|
||||
log.Errorf("%s: Error close stderr: %s", container.ID, err)
|
||||
}
|
||||
|
||||
if container.command != nil && container.command.Terminal != nil {
|
||||
if err := container.command.Terminal.Close(); err != nil {
|
||||
utils.Errorf("%s: Error closing terminal: %s", container.ID, err)
|
||||
log.Errorf("%s: Error closing terminal: %s", container.ID, err)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -64,9 +64,6 @@ unix://[/path/to/socket] to use.
|
|||
**-p**=""
|
||||
Path to use for daemon PID file. Default is `/var/run/docker.pid`
|
||||
|
||||
**-r**=*true*|*false*
|
||||
Restart previously running containers. Default is true.
|
||||
|
||||
**-s**=""
|
||||
Force the Docker runtime to use a specific storage driver.
|
||||
|
||||
|
|
|
@ -71,7 +71,6 @@ expect an integer, and they can only be specified once.
|
|||
--mtu=0 Set the containers network MTU
|
||||
if no value is provided: default to the default route MTU or 1500 if no default route is available
|
||||
-p, --pidfile="/var/run/docker.pid" Path to use for daemon PID file
|
||||
-r, --restart=true Restart previously running containers
|
||||
-s, --storage-driver="" Force the Docker runtime to use a specific storage driver
|
||||
--selinux-enabled=false Enable selinux support. SELinux does not presently support the BTRFS storage driver
|
||||
--storage-opt=[] Set storage driver options
|
||||
|
|
Loading…
Reference in a new issue