Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com>
This commit is contained in:
Alexandr Morozov 2014-08-13 11:37:30 +04:00
Родитель 64579f51fc
Коммит 391c35c822
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 59BF89FA47378873
8 изменённых файлов: 24 добавлений и 13 удалений

Просмотреть файл

@ -64,7 +64,12 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba
} }
c.Terminal = term c.Terminal = term
c.Mounts = append(c.Mounts, execdriver.Mount{d.initPath, c.InitPath, false, true}) c.Mounts = append(c.Mounts, execdriver.Mount{
Source: d.initPath,
Destination: c.InitPath,
Writable: false,
Private: true,
})
if err := d.generateEnvConfig(c); err != nil { if err := d.generateEnvConfig(c); err != nil {
return -1, err return -1, err
@ -440,7 +445,12 @@ func (d *driver) generateEnvConfig(c *execdriver.Command) error {
return err return err
} }
p := path.Join(d.root, "containers", c.ID, "config.env") p := path.Join(d.root, "containers", c.ID, "config.env")
c.Mounts = append(c.Mounts, execdriver.Mount{p, "/.dockerenv", false, true}) c.Mounts = append(c.Mounts, execdriver.Mount{
Source: p,
Destination: "/.dockerenv",
Writable: false,
Private: true,
})
return ioutil.WriteFile(p, data, 0600) return ioutil.WriteFile(p, data, 0600)
} }

Просмотреть файл

@ -61,6 +61,6 @@ func initializer() {
} }
func writeError(err error) { func writeError(err error) {
fmt.Sprint(os.Stderr, err) fmt.Fprint(os.Stderr, err)
os.Exit(1) os.Exit(1)
} }

Просмотреть файл

@ -71,7 +71,7 @@ func (daemon *Daemon) ContainerLogs(job *engine.Job) engine.Status {
var err error var err error
lines, err = strconv.Atoi(tail) lines, err = strconv.Atoi(tail)
if err != nil { if err != nil {
utils.Errorf("Failed to parse tail %s, error: %v, show all logs", err) utils.Errorf("Failed to parse tail %s, error: %v, show all logs", tail, err)
lines = -1 lines = -1
} }
} }

Просмотреть файл

@ -1,11 +1,12 @@
package portmapper package portmapper
import ( import (
"net"
"testing"
"github.com/docker/docker/daemon/networkdriver/portallocator" "github.com/docker/docker/daemon/networkdriver/portallocator"
"github.com/docker/docker/pkg/iptables" "github.com/docker/docker/pkg/iptables"
"github.com/docker/docker/pkg/proxy" "github.com/docker/docker/pkg/proxy"
"net"
"testing"
) )
func init() { func init() {
@ -138,7 +139,7 @@ func TestMapAllPortsSingleInterface(t *testing.T) {
} }
if _, err := Map(srcAddr1, dstIp1, portallocator.BeginPortRange); err == nil { if _, err := Map(srcAddr1, dstIp1, portallocator.BeginPortRange); err == nil {
t.Fatal("Port %d should be bound but is not", portallocator.BeginPortRange) t.Fatalf("Port %d should be bound but is not", portallocator.BeginPortRange)
} }
for _, val := range hosts { for _, val := range hosts {

Просмотреть файл

@ -37,7 +37,7 @@ func TestStateRunStop(t *testing.T) {
t.Fatalf("Pid %v, expected %v", runPid, i+100) t.Fatalf("Pid %v, expected %v", runPid, i+100)
} }
if pid, err := s.WaitRunning(-1 * time.Second); err != nil || pid != i+100 { if pid, err := s.WaitRunning(-1 * time.Second); err != nil || pid != i+100 {
t.Fatal("WaitRunning returned pid: %v, err: %v, expected pid: %v, err: %v", pid, err, i+100, nil) t.Fatalf("WaitRunning returned pid: %v, err: %v, expected pid: %v, err: %v", pid, err, i+100, nil)
} }
stopped := make(chan struct{}) stopped := make(chan struct{})
@ -68,7 +68,7 @@ func TestStateRunStop(t *testing.T) {
t.Fatalf("ExitCode %v, expected %v", exitCode, i) t.Fatalf("ExitCode %v, expected %v", exitCode, i)
} }
if exitCode, err := s.WaitStop(-1 * time.Second); err != nil || exitCode != i { if exitCode, err := s.WaitStop(-1 * time.Second); err != nil || exitCode != i {
t.Fatal("WaitStop returned exitCode: %v, err: %v, expected exitCode: %v, err: %v", exitCode, err, i, nil) t.Fatalf("WaitStop returned exitCode: %v, err: %v, expected exitCode: %v, err: %v", exitCode, err, i, nil)
} }
} }
} }

Просмотреть файл

@ -1836,7 +1836,7 @@ func TestBuildFromGIT(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
if res != "docker" { if res != "docker" {
t.Fatal("Maintainer should be docker, got %s", res) t.Fatalf("Maintainer should be docker, got %s", res)
} }
logDone("build - build from GIT") logDone("build - build from GIT")
} }

Просмотреть файл

@ -76,7 +76,7 @@ func TestCLIGetEventsContainerEvents(t *testing.T) {
eventsCmd := exec.Command(dockerBinary, "events", "--since=0", fmt.Sprintf("--until=%d", time.Now().Unix())) eventsCmd := exec.Command(dockerBinary, "events", "--since=0", fmt.Sprintf("--until=%d", time.Now().Unix()))
out, exitCode, err := runCommandWithOutput(eventsCmd) out, exitCode, err := runCommandWithOutput(eventsCmd)
if exitCode != 0 || err != nil { if exitCode != 0 || err != nil {
t.Fatal("Failed to get events with exit code %d: %s", exitCode, err) t.Fatalf("Failed to get events with exit code %d: %s", exitCode, err)
} }
events := strings.Split(out, "\n") events := strings.Split(out, "\n")
events = events[:len(events)-1] events = events[:len(events)-1]
@ -119,7 +119,7 @@ func TestCLIGetEventsImageUntagDelete(t *testing.T) {
eventsCmd := exec.Command(dockerBinary, "events", "--since=0", fmt.Sprintf("--until=%d", time.Now().Unix())) eventsCmd := exec.Command(dockerBinary, "events", "--since=0", fmt.Sprintf("--until=%d", time.Now().Unix()))
out, exitCode, err := runCommandWithOutput(eventsCmd) out, exitCode, err := runCommandWithOutput(eventsCmd)
if exitCode != 0 || err != nil { if exitCode != 0 || err != nil {
t.Fatal("Failed to get events with exit code %d: %s", exitCode, err) t.Fatalf("Failed to get events with exit code %d: %s", exitCode, err)
} }
events := strings.Split(out, "\n") events := strings.Split(out, "\n")
t.Log(events) t.Log(events)

Просмотреть файл

@ -102,7 +102,7 @@ func TestContainerOrphaning(t *testing.T) {
t.Fatalf("%v: %s", err, out) t.Fatalf("%v: %s", err, out)
} }
if !strings.Contains(out, img1) { if !strings.Contains(out, img1) {
t.Fatal("Orphaned container (could not find '%s' in docker images): %s", img1, out) t.Fatalf("Orphaned container (could not find '%s' in docker images): %s", img1, out)
} }
deleteAllContainers() deleteAllContainers()