From 5e859cf3c1945ae19b5c0607a0f15c94529a1286 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Tue, 31 Jan 2017 12:31:00 -0500 Subject: [PATCH 1/5] Update systemd drop-in link Right now it redirects, so change it to the correct one. Signed-off-by: Christopher Jones (cherry picked from commit 7c763b360a08f9a079fd041cbe38ab71efc3cd11) Signed-off-by: Victor Vieux --- contrib/init/sysvinit-debian/docker.default | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/init/sysvinit-debian/docker.default b/contrib/init/sysvinit-debian/docker.default index e217d7995e..c4e93199b4 100644 --- a/contrib/init/sysvinit-debian/docker.default +++ b/contrib/init/sysvinit-debian/docker.default @@ -4,7 +4,7 @@ # THIS FILE DOES NOT APPLY TO SYSTEMD # # Please see the documentation for "systemd drop-ins": -# https://docs.docker.com/engine/articles/systemd/ +# https://docs.docker.com/engine/admin/systemd/ # # Customize location of Docker binary (especially for development testing). From 7b15b4a9b2aba879b01bacfdbde01ac58ecefda3 Mon Sep 17 00:00:00 2001 From: John Howard Date: Tue, 31 Jan 2017 16:46:59 -0800 Subject: [PATCH 2/5] Revendor Microsoft/go-winio v0.3.8 Signed-off-by: John Howard (cherry picked from commit da6739c99f7e6bf5036073a6c052e6c6d86a461b) Signed-off-by: Victor Vieux --- vendor.conf | 2 +- vendor/github.com/Microsoft/go-winio/backuptar/tar.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor.conf b/vendor.conf index dc9780fa04..74f3e3c34a 100644 --- a/vendor.conf +++ b/vendor.conf @@ -1,7 +1,7 @@ # the following lines are in sorted order, FYI github.com/Azure/go-ansiterm 388960b655244e76e24c75f48631564eaefade62 github.com/Microsoft/hcsshim v0.5.9 -github.com/Microsoft/go-winio v0.3.7 +github.com/Microsoft/go-winio v0.3.8 github.com/Sirupsen/logrus v0.11.0 github.com/davecgh/go-spew 6d212800a42e8ab5c146b8ace3490ee17e5225f9 github.com/docker/libtrust 9cbd2a1374f46905c68a4eb3694a130610adc62a diff --git a/vendor/github.com/Microsoft/go-winio/backuptar/tar.go b/vendor/github.com/Microsoft/go-winio/backuptar/tar.go index 182d8450d3..cfbcedfe04 100644 --- a/vendor/github.com/Microsoft/go-winio/backuptar/tar.go +++ b/vendor/github.com/Microsoft/go-winio/backuptar/tar.go @@ -339,7 +339,7 @@ func WriteBackupStreamFromTarFile(w io.Writer, t *tar.Reader, hdr *tar.Header) ( bhdr := winio.BackupHeader{ Id: winio.BackupAlternateData, Size: ahdr.Size, - Name: ahdr.Name[len(hdr.Name)+1:] + ":$DATA", + Name: ahdr.Name[len(hdr.Name):] + ":$DATA", } err = bw.WriteHeader(&bhdr) if err != nil { From 68f9fb9fd7d49d95f3a90e73ccc8b288a9a55259 Mon Sep 17 00:00:00 2001 From: Tibor Vass Date: Tue, 17 Jan 2017 10:27:01 -0800 Subject: [PATCH 3/5] plugin: use pkg/errors in more places Also provide stack trace output in daemon logs. Signed-off-by: Tibor Vass (cherry picked from commit 26d0bac8955903bc3a845358d159b2ec2f7c253f) Signed-off-by: Victor Vieux --- api/server/server.go | 2 +- plugin/manager.go | 2 +- plugin/manager_linux.go | 8 ++++---- plugin/v2/plugin_linux.go | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/api/server/server.go b/api/server/server.go index d988b8e17f..22904af0e1 100644 --- a/api/server/server.go +++ b/api/server/server.go @@ -137,7 +137,7 @@ func (s *Server) makeHTTPHandler(handler httputils.APIFunc) http.HandlerFunc { } if err := handlerFunc(ctx, w, r, vars); err != nil { - logrus.Errorf("Handler for %s %s returned error: %v", r.Method, r.URL.Path, err) + logrus.Errorf("Handler for %s %s returned error: %+v", r.Method, r.URL.Path, err) httputils.MakeErrorHandler(err)(w, r) } } diff --git a/plugin/manager.go b/plugin/manager.go index 1954784fb3..2598321e60 100644 --- a/plugin/manager.go +++ b/plugin/manager.go @@ -237,7 +237,7 @@ func (pm *Manager) save(p *v2.Plugin) error { return errors.Wrap(err, "failed to marshal plugin json") } if err := ioutils.AtomicWriteFile(filepath.Join(pm.config.Root, p.GetID(), configFileName), pluginJSON, 0600); err != nil { - return err + return errors.Wrap(err, "failed to write atomically plugin json") } return nil } diff --git a/plugin/manager_linux.go b/plugin/manager_linux.go index a5083154d1..4e3c98de30 100644 --- a/plugin/manager_linux.go +++ b/plugin/manager_linux.go @@ -42,12 +42,12 @@ func (pm *Manager) enable(p *v2.Plugin, c *controller, force bool) error { if p.PropagatedMount != "" { if err := mount.MakeRShared(p.PropagatedMount); err != nil { - return err + return errors.WithStack(err) } } if err := initlayer.Setup(filepath.Join(pm.config.Root, p.PluginObj.ID, rootFSFileName), 0, 0); err != nil { - return err + return errors.WithStack(err) } if err := pm.containerdClient.Create(p.GetID(), "", "", specs.Spec(*spec), attachToLog(p.GetID())); err != nil { @@ -56,7 +56,7 @@ func (pm *Manager) enable(p *v2.Plugin, c *controller, force bool) error { logrus.Warnf("Could not unmount %s: %v", p.PropagatedMount, err) } } - return err + return errors.WithStack(err) } return pm.pluginPostStart(p, c) @@ -67,7 +67,7 @@ func (pm *Manager) pluginPostStart(p *v2.Plugin, c *controller) error { if err != nil { c.restart = false shutdownPlugin(p, c, pm.containerdClient) - return err + return errors.WithStack(err) } p.SetPClient(client) diff --git a/plugin/v2/plugin_linux.go b/plugin/v2/plugin_linux.go index f1c2da0bc7..e980e7f29a 100644 --- a/plugin/v2/plugin_linux.go +++ b/plugin/v2/plugin_linux.go @@ -3,7 +3,6 @@ package v2 import ( - "errors" "os" "path/filepath" "strings" @@ -12,6 +11,7 @@ import ( "github.com/docker/docker/oci" "github.com/docker/docker/pkg/system" specs "github.com/opencontainers/runtime-spec/specs-go" + "github.com/pkg/errors" ) // InitSpec creates an OCI spec from the plugin's config. @@ -29,7 +29,7 @@ func (p *Plugin) InitSpec(execRoot string) (*specs.Spec, error) { execRoot = filepath.Join(execRoot, p.PluginObj.ID) if err := os.MkdirAll(execRoot, 0700); err != nil { - return nil, err + return nil, errors.WithStack(err) } mounts := append(p.PluginObj.Config.Mounts, types.PluginMount{ @@ -95,7 +95,7 @@ func (p *Plugin) InitSpec(execRoot string) (*specs.Spec, error) { path := *dev.Path d, dPermissions, err := oci.DevicesFromPath(path, path, "rwm") if err != nil { - return nil, err + return nil, errors.WithStack(err) } s.Linux.Devices = append(s.Linux.Devices, d...) s.Linux.Resources.Devices = append(s.Linux.Resources.Devices, dPermissions...) From ec0e3fe4e226f5a635b6a2d5eda33f8a3aea2c3c Mon Sep 17 00:00:00 2001 From: Harald Albers Date: Wed, 25 Jan 2017 12:55:56 +0100 Subject: [PATCH 4/5] Add bash completion for `docker checkpoint` Signed-off-by: Harald Albers (cherry picked from commit 926fa56c0dc60eb1ad576a2f8a35d69ae967df16) Signed-off-by: Victor Vieux --- contrib/completion/bash/docker | 107 ++++++++++++++++++++++++++++++++- 1 file changed, 106 insertions(+), 1 deletion(-) diff --git a/contrib/completion/bash/docker b/contrib/completion/bash/docker index 1af040b6cd..7ea5d9a9f4 100644 --- a/contrib/completion/bash/docker +++ b/contrib/completion/bash/docker @@ -914,6 +914,94 @@ _docker_build() { } +_docker_checkpoint() { + local subcommands=" + create + ls + rm + " + local aliases=" + list + remove + " + __docker_subcommands "$subcommands $aliases" && return + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) ) + ;; + esac +} + +_docker_checkpoint_create() { + case "$prev" in + --checkpoint-dir) + _filedir -d + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--checkpoint-dir --help --leave-running" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag '--checkpoint-dir') + if [ $cword -eq $counter ]; then + __docker_complete_containers_running + fi + ;; + esac +} + +_docker_checkpoint_ls() { + case "$prev" in + --checkpoint-dir) + _filedir -d + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--checkpoint-dir --help" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag '--checkpoint-dir') + if [ $cword -eq $counter ]; then + __docker_complete_containers_all + fi + ;; + esac +} + +_docker_checkpoint_rm() { + case "$prev" in + --checkpoint-dir) + _filedir -d + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--checkpoint-dir --help" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag '--checkpoint-dir') + if [ $cword -eq $counter ]; then + __docker_complete_containers_all + elif [ $cword -eq $(($counter + 1)) ]; then + COMPREPLY=( $( compgen -W "$(__docker_q checkpoint ls "$prev" | sed 1d)" -- "$cur" ) ) + fi + ;; + esac +} + + _docker_container() { local subcommands=" attach @@ -1600,9 +1688,25 @@ _docker_container_run() { _docker_container_start() { __docker_complete_detach-keys && return + case "$prev" in + --checkpoint) + if [ __docker_is_experimental ] ; then + return + fi + ;; + --checkpoint-dir) + if [ __docker_is_experimental ] ; then + _filedir -d + return + fi + ;; + esac + case "$cur" in -*) - COMPREPLY=( $( compgen -W "--attach -a --detach-keys --help --interactive -i" -- "$cur" ) ) + local options="--attach -a --detach-keys --help --interactive -i" + __docker_is_experimental && options+=" --checkpoint --checkpoint-dir" + COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) ;; *) __docker_complete_containers_stopped @@ -4097,6 +4201,7 @@ _docker() { ) local experimental_commands=( + checkpoint deploy ) From 553d56d4569da502d2755090257e79553318c862 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 31 Jan 2017 16:39:13 -0800 Subject: [PATCH 5/5] install dirmngr if needed as of Ubuntu Yakkety, dirmngr is now in a separate package (see https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1634464) this patch updates the install script to install the dirmngr package if it's not installed. Signed-off-by: Sebastiaan van Stijn (cherry picked from commit f5263c8074c091555592787e32319a6a4f39e650) Signed-off-by: Victor Vieux --- hack/install.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hack/install.sh b/hack/install.sh index 23f202319f..cc20d69396 100644 --- a/hack/install.sh +++ b/hack/install.sh @@ -406,11 +406,17 @@ do_install() { ( set -x; $sh_c 'sleep 3; apt-get install -y -q curl ca-certificates' ) curl='curl -sSL' fi - if [ ! -e /usr/bin/gpg ]; then + if ! command -v gpg > /dev/null; then apt_get_update ( set -x; $sh_c 'sleep 3; apt-get install -y -q gnupg2 || apt-get install -y -q gnupg' ) fi + # dirmngr is a separate package in ubuntu yakkety; see https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1634464 + if ! command -v dirmngr > /dev/null; then + apt_get_update + ( set -x; $sh_c 'sleep 3; apt-get install -y -q dirmngr' ) + fi + ( set -x for key_server in $key_servers ; do