Просмотр исходного кода

Merge pull request #1510 from dotcloud/bump_0.5.3

Bump to 0.5.3
Michael Crosby 12 лет назад
Родитель
Сommit
06a092bdb5
8 измененных файлов с 35 добавлено и 6 удалено
  1. 7 0
      CHANGELOG.md
  2. 15 1
      api.go
  3. 2 2
      buildfile.go
  4. 1 1
      commands.go
  5. 1 0
      container.go
  6. 1 0
      container_test.go
  7. 5 1
      network.go
  8. 3 1
      packaging/ubuntu/docker.upstart

+ 7 - 0
CHANGELOG.md

@@ -1,5 +1,12 @@
 # Changelog
 
+## 0.5.3 (2013-08-13)
+* Runtime: Use docker group for socket permissions
+- Runtime: Spawn shell within upstart script
+- Builder: Make sure ENV instruction within build perform a commit each time
+- Runtime: Handle ip route showing mask-less IP addresses
+- Runtime: Add hostname to environment
+
 ## 0.5.2 (2013-08-08)
  * Builder: Forbid certain paths within docker build ADD
  - Runtime: Change network range to avoid conflict with EC2 DNS

+ 15 - 1
api.go

@@ -13,6 +13,7 @@ import (
 	"net/http"
 	"os"
 	"os/exec"
+	"regexp"
 	"strconv"
 	"strings"
 )
@@ -974,7 +975,20 @@ func ListenAndServe(proto, addr string, srv *Server, logging bool) error {
 		return e
 	}
 	if proto == "unix" {
-		os.Chmod(addr, 0700)
+		os.Chmod(addr, 0660)
+		groups, err := ioutil.ReadFile("/etc/group")
+		if err != nil {
+			return err
+		}
+		re := regexp.MustCompile("(^|\n)docker:.*?:([0-9]+)")
+		if gidMatch := re.FindStringSubmatch(string(groups)); gidMatch != nil {
+			gid, err := strconv.Atoi(gidMatch[2])
+			if err != nil {
+				return err
+			}
+			utils.Debugf("docker group found. gid: %d", gid)
+			os.Chown(addr, 0, gid)
+		}
 	}
 	httpSrv := http.Server{Addr: addr, Handler: r}
 	return httpSrv.Serve(l)

+ 2 - 2
buildfile.go

@@ -167,9 +167,9 @@ func (b *buildFile) CmdEnv(args string) error {
 
 	if envKey >= 0 {
 		b.config.Env[envKey] = replacedVar
-		return nil
+	} else {
+		b.config.Env = append(b.config.Env, replacedVar)
 	}
-	b.config.Env = append(b.config.Env, replacedVar)
 	return b.commit("", b.config.Cmd, fmt.Sprintf("ENV %s", replacedVar))
 }
 

+ 1 - 1
commands.go

@@ -27,7 +27,7 @@ import (
 	"unicode"
 )
 
-const VERSION = "0.5.2"
+const VERSION = "0.5.3"
 
 var (
 	GITCOMMIT string

+ 1 - 0
container.go

@@ -652,6 +652,7 @@ func (container *Container) Start(hostConfig *HostConfig) error {
 		"-e", "HOME=/",
 		"-e", "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
 		"-e", "container=lxc",
+		"-e", "HOSTNAME="+container.Config.Hostname,
 	)
 
 	for _, elem := range container.Config.Env {

+ 1 - 0
container_test.go

@@ -960,6 +960,7 @@ func TestEnv(t *testing.T) {
 		"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
 		"HOME=/",
 		"container=lxc",
+		"HOSTNAME=" + container.ShortID(),
 	}
 	sort.Strings(goodEnv)
 	if len(goodEnv) != len(actualEnv) {

+ 5 - 1
network.go

@@ -104,7 +104,11 @@ func checkRouteOverlaps(dockerNetwork *net.IPNet) error {
 			continue
 		}
 		if _, network, err := net.ParseCIDR(strings.Split(line, " ")[0]); err != nil {
-			return fmt.Errorf("Unexpected ip route output: %s (%s)", err, line)
+			// is this a mask-less IP address?
+			if ip := net.ParseIP(strings.Split(line, " ")[0]); ip == nil {
+				// fail only if it's neither a network nor a mask-less IP address
+				return fmt.Errorf("Unexpected ip route output: %s (%s)", err, line)
+			}
 		} else if networkOverlaps(dockerNetwork, network) {
 			return fmt.Errorf("Network %s is already routed: '%s'", dockerNetwork.String(), line)
 		}

+ 3 - 1
packaging/ubuntu/docker.upstart

@@ -5,4 +5,6 @@ stop on runlevel [!2345]
 
 respawn
 
-exec /usr/bin/docker -d
+script
+    /usr/bin/docker -d
+end script