瀏覽代碼

Merge pull request #7172 from vieux/bump_v1.1.2

Bump v1.1.2
Victor Vieux 11 年之前
父節點
當前提交
1df87acb33
共有 5 個文件被更改,包括 35 次插入13 次删除
  1. 9 0
      CHANGELOG.md
  2. 1 1
      VERSION
  3. 5 1
      contrib/init/sysvinit-debian/docker
  4. 11 2
      daemon/container.go
  5. 9 9
      daemon/daemon.go

+ 9 - 0
CHANGELOG.md

@@ -1,5 +1,14 @@
 # Changelog
 # 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)
 ## 1.1.1 (2014-07-09)
 
 
 #### Builder
 #### Builder

+ 1 - 1
VERSION

@@ -1 +1 @@
-1.1.1
+1.1.2

+ 5 - 1
contrib/init/sysvinit-debian/docker

@@ -89,7 +89,11 @@ case "$1" in
 		chgrp docker "$DOCKER_LOGFILE"
 		chgrp docker "$DOCKER_LOGFILE"
 
 
 		ulimit -n 1048576
 		ulimit -n 1048576
-		ulimit -u 1048576
+		if [ "$BASH" ]; then
+			ulimit -u 1048576
+		else
+			ulimit -p 1048576
+		fi
 
 
 		log_begin_msg "Starting $DOCKER_DESC: $BASE"
 		log_begin_msg "Starting $DOCKER_DESC: $BASE"
 		start-stop-daemon --start --background \
 		start-stop-daemon --start --background \

+ 11 - 2
daemon/container.go

@@ -422,8 +422,17 @@ func (container *Container) allocateNetwork() error {
 	if container.Config.ExposedPorts != nil {
 	if container.Config.ExposedPorts != nil {
 		portSpecs = container.Config.ExposedPorts
 		portSpecs = container.Config.ExposedPorts
 	}
 	}
+
 	if container.hostConfig.PortBindings != nil {
 	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
 	container.NetworkSettings.PortMapping = nil
@@ -1080,10 +1089,10 @@ func (container *Container) waitForStart() error {
 				c.Close()
 				c.Close()
 			}
 			}
 		}
 		}
+		container.State.SetRunning(command.Pid())
 		if err := container.ToDisk(); err != nil {
 		if err := container.ToDisk(); err != nil {
 			utils.Debugf("%s", err)
 			utils.Debugf("%s", err)
 		}
 		}
-		container.State.SetRunning(command.Pid())
 	}
 	}
 
 
 	// We use a callback here instead of a goroutine and an chan for
 	// We use a callback here instead of a goroutine and an chan for

+ 9 - 9
daemon/daemon.go

@@ -209,6 +209,7 @@ func (daemon *Daemon) register(container *Container, updateSuffixarray bool, con
 			}
 			}
 			daemon.execDriver.Terminate(cmd)
 			daemon.execDriver.Terminate(cmd)
 		}
 		}
+
 		if err := container.Unmount(); err != nil {
 		if err := container.Unmount(); err != nil {
 			utils.Debugf("unmount error %s", err)
 			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)
 		info := daemon.execDriver.Info(container.ID)
 		if !info.IsRunning() {
 		if !info.IsRunning() {
 			utils.Debugf("Container %s was supposed to be running but is not.", container.ID)
 			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 {
 			if daemon.config.AutoRestart {
 				utils.Debugf("Marking as restarting")
 				utils.Debugf("Marking as restarting")
-				if err := container.Unmount(); err != nil {
-					utils.Debugf("restart unmount error %s", err)
-				}
 
 
 				if containersToStart != nil {
 				if containersToStart != nil {
 					*containersToStart = append(*containersToStart, container)
 					*containersToStart = append(*containersToStart, container)
 				}
 				}
-			} else {
-				utils.Debugf("Marking as stopped")
-				container.State.SetStopped(-127)
-				if err := container.ToDisk(); err != nil {
-					return err
-				}
 			}
 			}
 		}
 		}
 	}
 	}