diff --git a/CHANGELOG.md b/CHANGELOG.md index 327a8a7e69..8ec9ce3df0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 1.1.2 (2014-07-23) + +#### Runtime ++ Fix port allocation for existing containers ++ Fix containers restart on daemon restart + +#### Packaging ++ Fix /etc/init.d/docker issue on Debian + ## 1.1.1 (2014-07-09) #### Builder diff --git a/VERSION b/VERSION index 524cb55242..45a1b3f445 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.1.1 +1.1.2 diff --git a/contrib/init/sysvinit-debian/docker b/contrib/init/sysvinit-debian/docker index 6250cae053..d79d9c6c07 100755 --- a/contrib/init/sysvinit-debian/docker +++ b/contrib/init/sysvinit-debian/docker @@ -89,7 +89,11 @@ case "$1" in chgrp docker "$DOCKER_LOGFILE" ulimit -n 1048576 - ulimit -u 1048576 + if [ "$BASH" ]; then + ulimit -u 1048576 + else + ulimit -p 1048576 + fi log_begin_msg "Starting $DOCKER_DESC: $BASE" start-stop-daemon --start --background \ diff --git a/daemon/container.go b/daemon/container.go index 5b41438680..30337de6b5 100644 --- a/daemon/container.go +++ b/daemon/container.go @@ -422,8 +422,17 @@ func (container *Container) allocateNetwork() error { if container.Config.ExposedPorts != nil { portSpecs = container.Config.ExposedPorts } + if container.hostConfig.PortBindings != nil { - bindings = container.hostConfig.PortBindings + for p, b := range container.hostConfig.PortBindings { + bindings[p] = []nat.PortBinding{} + for _, bb := range b { + bindings[p] = append(bindings[p], nat.PortBinding{ + HostIp: bb.HostIp, + HostPort: bb.HostPort, + }) + } + } } container.NetworkSettings.PortMapping = nil @@ -1080,10 +1089,10 @@ func (container *Container) waitForStart() error { c.Close() } } + container.State.SetRunning(command.Pid()) if err := container.ToDisk(); err != nil { utils.Debugf("%s", err) } - container.State.SetRunning(command.Pid()) } // We use a callback here instead of a goroutine and an chan for diff --git a/daemon/daemon.go b/daemon/daemon.go index 23402d9518..a94a4458ad 100644 --- a/daemon/daemon.go +++ b/daemon/daemon.go @@ -209,6 +209,7 @@ func (daemon *Daemon) register(container *Container, updateSuffixarray bool, con } daemon.execDriver.Terminate(cmd) } + if err := container.Unmount(); err != nil { utils.Debugf("unmount error %s", err) } @@ -219,21 +220,20 @@ func (daemon *Daemon) register(container *Container, updateSuffixarray bool, con info := daemon.execDriver.Info(container.ID) if !info.IsRunning() { utils.Debugf("Container %s was supposed to be running but is not.", container.ID) + + utils.Debugf("Marking as stopped") + + container.State.SetStopped(-127) + if err := container.ToDisk(); err != nil { + return err + } + if daemon.config.AutoRestart { utils.Debugf("Marking as restarting") - if err := container.Unmount(); err != nil { - utils.Debugf("restart unmount error %s", err) - } if containersToStart != nil { *containersToStart = append(*containersToStart, container) } - } else { - utils.Debugf("Marking as stopped") - container.State.SetStopped(-127) - if err := container.ToDisk(); err != nil { - return err - } } } }