Skip to content

Commit

Permalink
Merge pull request moby#4831 from unclejack/final_bump_v0.9.1
Browse files Browse the repository at this point in the history
Bump to version 0.9.1
  • Loading branch information
unclejack committed Mar 25, 2014
2 parents 143c970 + 3600720 commit 867b2a9
Show file tree
Hide file tree
Showing 47 changed files with 901 additions and 407 deletions.
40 changes: 40 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,45 @@
# Changelog

## 0.9.1 (2014-03-24)

#### Builder
- Fix printing multiple messages on a single line. Fixes broken output during builds.

#### Documentation
- Fix external link on security of containers.

#### Contrib
- Fix init script cgroup mounting workarounds to be more similar to cgroupfs-mount and thus work properly.
- Add variable for DOCKER_LOGFILE to sysvinit and use append instead of overwrite in opening the logfile.

#### Hack
- Generate md5 and sha256 hashes when building, and upload them via hack/release.sh.

#### Remote API
- Fix content-type detection in `docker cp`.

#### Runtime
- Use BSD raw mode on Darwin. Fixes nano, tmux and others.
- Only unshare the mount namespace for execin.
- Retry to retrieve the layer metadata up to 5 times for `docker pull`.
- Merge existing config when committing.
- Fix panic in monitor.
- Disable daemon startup timeout.
- Fix issue #4681: add loopback interface when networking is disabled.
- Add failing test case for issue #4681.
- Send SIGTERM to child, instead of SIGKILL.
- Show the driver and the kernel version in `docker info` even when not in debug mode.
- Always symlink /dev/ptmx for libcontainer. This fixes console related problems.
- Fix issue caused by the absence of /etc/apparmor.d.
- Don't leave empty cidFile behind when failing to create the container.
- Improve deprecation message.
- Fix attach exit on darwin.
- devicemapper: improve handling of devicemapper devices (add per device lock, increase sleep time, unlock while sleeping).
- devicemapper: succeed immediately when removing non-existing devices.
- devicemapper: increase timeout in waitClose to 10 seconds.
- Remove goroutine leak on error.
- Update parseLxcInfo to comply with new lxc1.0 format.

## 0.9.0 (2014-03-10)

#### Builder
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.9.0
0.9.1
59 changes: 45 additions & 14 deletions api/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/dotcloud/docker/engine"
"github.com/dotcloud/docker/nat"
flag "github.com/dotcloud/docker/pkg/mflag"
"github.com/dotcloud/docker/pkg/signal"
"github.com/dotcloud/docker/pkg/term"
"github.com/dotcloud/docker/registry"
"github.com/dotcloud/docker/runconfig"
Expand All @@ -24,11 +25,11 @@ import (
"net/http/httputil"
"net/url"
"os"
"os/signal"
gosignal "os/signal"
"path"
"reflect"
"regexp"
"runtime"
goruntime "runtime"
"strconv"
"strings"
"syscall"
Expand Down Expand Up @@ -367,7 +368,7 @@ func (cli *DockerCli) CmdVersion(args ...string) error {
if dockerversion.VERSION != "" {
fmt.Fprintf(cli.out, "Client version: %s\n", dockerversion.VERSION)
}
fmt.Fprintf(cli.out, "Go version (client): %s\n", runtime.Version())
fmt.Fprintf(cli.out, "Go version (client): %s\n", goruntime.Version())
if dockerversion.GITCOMMIT != "" {
fmt.Fprintf(cli.out, "Git commit (client): %s\n", dockerversion.GITCOMMIT)
}
Expand Down Expand Up @@ -432,22 +433,23 @@ func (cli *DockerCli) CmdInfo(args ...string) error {

fmt.Fprintf(cli.out, "Containers: %d\n", remoteInfo.GetInt("Containers"))
fmt.Fprintf(cli.out, "Images: %d\n", remoteInfo.GetInt("Images"))
fmt.Fprintf(cli.out, "Driver: %s\n", remoteInfo.Get("Driver"))
fmt.Fprintf(cli.out, "Storage Driver: %s\n", remoteInfo.Get("Driver"))
var driverStatus [][2]string
if err := remoteInfo.GetJson("DriverStatus", &driverStatus); err != nil {
return err
}
for _, pair := range driverStatus {
fmt.Fprintf(cli.out, " %s: %s\n", pair[0], pair[1])
}
fmt.Fprintf(cli.out, "Execution Driver: %s\n", remoteInfo.Get("ExecutionDriver"))
fmt.Fprintf(cli.out, "Kernel Version: %s\n", remoteInfo.Get("KernelVersion"))

if remoteInfo.GetBool("Debug") || os.Getenv("DEBUG") != "" {
fmt.Fprintf(cli.out, "Debug mode (server): %v\n", remoteInfo.GetBool("Debug"))
fmt.Fprintf(cli.out, "Debug mode (client): %v\n", os.Getenv("DEBUG") != "")
fmt.Fprintf(cli.out, "Fds: %d\n", remoteInfo.GetInt("NFd"))
fmt.Fprintf(cli.out, "Goroutines: %d\n", remoteInfo.GetInt("NGoroutines"))
fmt.Fprintf(cli.out, "Execution Driver: %s\n", remoteInfo.Get("ExecutionDriver"))
fmt.Fprintf(cli.out, "EventsListeners: %d\n", remoteInfo.GetInt("NEventsListener"))
fmt.Fprintf(cli.out, "Kernel Version: %s\n", remoteInfo.Get("KernelVersion"))

if initSha1 := remoteInfo.Get("InitSha1"); initSha1 != "" {
fmt.Fprintf(cli.out, "Init SHA1: %s\n", initSha1)
Expand Down Expand Up @@ -533,13 +535,23 @@ func (cli *DockerCli) CmdRestart(args ...string) error {

func (cli *DockerCli) forwardAllSignals(cid string) chan os.Signal {
sigc := make(chan os.Signal, 1)
utils.CatchAll(sigc)
signal.CatchAll(sigc)
go func() {
for s := range sigc {
if s == syscall.SIGCHLD {
continue
}
if _, _, err := readBody(cli.call("POST", fmt.Sprintf("/containers/%s/kill?signal=%d", cid, s), nil, false)); err != nil {
var sig string
for sigStr, sigN := range signal.SignalMap {
if sigN == s {
sig = sigStr
break
}
}
if sig == "" {
utils.Errorf("Unsupported signal: %d. Discarding.", s)
}
if _, _, err := readBody(cli.call("POST", fmt.Sprintf("/containers/%s/kill?signal=%s", cid, sig), nil, false)); err != nil {
utils.Debugf("Error sending signal: %s", err)
}
}
Expand Down Expand Up @@ -581,7 +593,7 @@ func (cli *DockerCli) CmdStart(args ...string) error {

if !container.Config.Tty {
sigc := cli.forwardAllSignals(cmd.Arg(0))
defer utils.StopCatch(sigc)
defer signal.StopCatch(sigc)
}

var in io.ReadCloser
Expand Down Expand Up @@ -1614,7 +1626,7 @@ func (cli *DockerCli) CmdAttach(args ...string) error {

if *proxy && !container.Config.Tty {
sigc := cli.forwardAllSignals(cmd.Arg(0))
defer utils.StopCatch(sigc)
defer signal.StopCatch(sigc)
}

if err := cli.hijack("POST", "/containers/"+cmd.Arg(0)+"/attach?"+v.Encode(), container.Config.Tty, in, cli.out, cli.err, nil); err != nil {
Expand Down Expand Up @@ -1753,7 +1765,21 @@ func (cli *DockerCli) CmdRun(args ...string) error {
if containerIDFile, err = os.Create(hostConfig.ContainerIDFile); err != nil {
return fmt.Errorf("Failed to create the container ID file: %s", err)
}
defer containerIDFile.Close()
defer func() {
containerIDFile.Close()
var (
cidFileInfo os.FileInfo
err error
)
if cidFileInfo, err = os.Stat(hostConfig.ContainerIDFile); err != nil {
return
}
if cidFileInfo.Size() == 0 {
if err := os.Remove(hostConfig.ContainerIDFile); err != nil {
fmt.Printf("failed to remove CID file '%s': %s \n", hostConfig.ContainerIDFile, err)
}
}
}()
}

containerValues := url.Values{}
Expand Down Expand Up @@ -1818,7 +1844,7 @@ func (cli *DockerCli) CmdRun(args ...string) error {

if sigProxy {
sigc := cli.forwardAllSignals(runResult.Get("Id"))
defer utils.StopCatch(sigc)
defer signal.StopCatch(sigc)
}

var (
Expand Down Expand Up @@ -2239,7 +2265,12 @@ func (cli *DockerCli) hijack(method, path string, setRawTerminal bool, in io.Rea
if setRawTerminal && cli.isTerminal {
term.RestoreTerminal(cli.terminalFd, oldState)
}
in.Close()
// For some reason this Close call blocks on darwin..
// As the client exists right after, simply discard the close
// until we find a better solution.
if goruntime.GOOS != "darwin" {
in.Close()
}
}
}()

Expand Down Expand Up @@ -2320,7 +2351,7 @@ func (cli *DockerCli) monitorTtySize(id string) error {
cli.resizeTty(id)

sigchan := make(chan os.Signal, 1)
signal.Notify(sigchan, syscall.SIGWINCH)
gosignal.Notify(sigchan, syscall.SIGWINCH)
go func() {
for _ = range sigchan {
cli.resizeTty(id)
Expand Down
7 changes: 3 additions & 4 deletions api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"strconv"
"strings"
"syscall"
"time"
)

var (
Expand Down Expand Up @@ -883,7 +882,7 @@ func postContainersCopy(eng *engine.Engine, version version.Version, w http.Resp

var copyData engine.Env

if contentType := r.Header.Get("Content-Type"); contentType == "application/json" {
if contentType := r.Header.Get("Content-Type"); MatchesContentType(contentType, "application/json") {
if err := copyData.Decode(r.Body); err != nil {
return err
}
Expand Down Expand Up @@ -1130,7 +1129,7 @@ func changeGroup(addr string, nameOrGid string) error {

// ListenAndServe sets up the required http.Server and gets it listening for
// each addr passed in and does protocol specific checking.
func ListenAndServe(proto, addr string, eng *engine.Engine, logging, enableCors bool, dockerVersion string, socketGroup string) error {
func ListenAndServe(proto, addr string, eng *engine.Engine, logging, enableCors bool, dockerVersion, socketGroup string) error {
r, err := createRouter(eng, logging, enableCors, dockerVersion)

if err != nil {
Expand All @@ -1147,7 +1146,7 @@ func ListenAndServe(proto, addr string, eng *engine.Engine, logging, enableCors
}
}

l, err := listenbuffer.NewListenBuffer(proto, addr, activationLock, 15*time.Minute)
l, err := listenbuffer.NewListenBuffer(proto, addr, activationLock)
if err != nil {
return err
}
Expand Down
10 changes: 7 additions & 3 deletions container.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,14 +363,18 @@ func populateCommand(c *Container) {
driverConfig []string
)

en = &execdriver.Network{
Mtu: c.runtime.config.Mtu,
Interface: nil,
}

if !c.Config.NetworkDisabled {
network := c.NetworkSettings
en = &execdriver.Network{
en.Interface = &execdriver.NetworkInterface{
Gateway: network.Gateway,
Bridge: network.Bridge,
IPAddress: network.IPAddress,
IPPrefixLen: network.IPPrefixLen,
Mtu: c.runtime.config.Mtu,
}
}

Expand Down Expand Up @@ -784,7 +788,7 @@ func (container *Container) monitor(callback execdriver.StartCallback) error {
utils.Errorf("Error running container: %s", err)
}

if container.runtime.srv.IsRunning() {
if container.runtime != nil && container.runtime.srv != nil && container.runtime.srv.IsRunning() {
container.State.SetStopped(exitCode)

// FIXME: there is a race condition here which causes this to fail during the unit tests.
Expand Down
41 changes: 28 additions & 13 deletions contrib/init/sysvinit-debian/docker
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ BASE=$(basename $0)
# modify these in /etc/default/$BASE (/etc/default/docker)
DOCKER=/usr/bin/$BASE
DOCKER_PIDFILE=/var/run/$BASE.pid
DOCKER_LOGFILE=/var/log/$BASE.log
DOCKER_OPTS=
DOCKER_DESC="Docker"

Expand Down Expand Up @@ -50,23 +51,37 @@ fail_unless_root() {
fi
}

cgroupfs_mount() {
# see also https://github.com/tianon/cgroupfs-mount/blob/master/cgroupfs-mount
if grep -v '^#' /etc/fstab | grep -q cgroup \
|| [ ! -e /proc/cgroups ] \
|| [ ! -d /sys/fs/cgroup ]; then
return
fi
if ! mountpoint -q /sys/fs/cgroup; then
mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup
fi
(
cd /sys/fs/cgroup
for sys in $(awk '!/^#/ { if ($4 == 1) print $1 }' /proc/cgroups); do
mkdir -p $sys
if ! mountpoint -q $sys; then
if ! mount -n -t cgroup -o $sys cgroup $sys; then
rmdir $sys || true
fi
fi
done
)
}

case "$1" in
start)
fail_unless_root

if ! grep -q cgroup /proc/mounts; then
# rough approximation of cgroupfs-mount
mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup
for sys in $(cut -d' ' -f1 /proc/cgroups); do
mkdir -p /sys/fs/cgroup/$sys
if ! mount -n -t cgroup -o $sys cgroup /sys/fs/cgroup/$sys 2>/dev/null; then
rmdir /sys/fs/cgroup/$sys 2>/dev/null || true
fi
done
fi
cgroupfs_mount

touch /var/log/docker.log
chgrp docker /var/log/docker.log
touch "$DOCKER_LOGFILE"
chgrp docker "$DOCKER_LOGFILE"

log_begin_msg "Starting $DOCKER_DESC: $BASE"
start-stop-daemon --start --background \
Expand All @@ -76,7 +91,7 @@ case "$1" in
-- \
-d -p "$DOCKER_PIDFILE" \
$DOCKER_OPTS \
> /var/log/docker.log 2>&1
>> "$DOCKER_LOGFILE" 2>&1
log_end_msg $?
;;

Expand Down
33 changes: 23 additions & 10 deletions contrib/init/upstart/docker.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,35 @@ stop on runlevel [!2345]

respawn

pre-start script
# see also https://github.com/tianon/cgroupfs-mount/blob/master/cgroupfs-mount
if grep -v '^#' /etc/fstab | grep -q cgroup \
|| [ ! -e /proc/cgroups ] \
|| [ ! -d /sys/fs/cgroup ]; then
exit 0
fi
if ! mountpoint -q /sys/fs/cgroup; then
mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup
fi
(
cd /sys/fs/cgroup
for sys in $(awk '!/^#/ { if ($4 == 1) print $1 }' /proc/cgroups); do
mkdir -p $sys
if ! mountpoint -q $sys; then
if ! mount -n -t cgroup -o $sys cgroup $sys; then
rmdir $sys || true
fi
fi
done
)
end script

script
# modify these in /etc/default/$UPSTART_JOB (/etc/default/docker)
DOCKER=/usr/bin/$UPSTART_JOB
DOCKER_OPTS=
if [ -f /etc/default/$UPSTART_JOB ]; then
. /etc/default/$UPSTART_JOB
fi
if ! grep -q cgroup /proc/mounts; then
# rough approximation of cgroupfs-mount
mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup
for sys in $(cut -d' ' -f1 /proc/cgroups); do
mkdir -p /sys/fs/cgroup/$sys
if ! mount -n -t cgroup -o $sys cgroup /sys/fs/cgroup/$sys 2>/dev/null; then
rmdir /sys/fs/cgroup/$sys 2>/dev/null || true
fi
done
fi
"$DOCKER" -d $DOCKER_OPTS
end script
Loading

0 comments on commit 867b2a9

Please sign in to comment.