| ... | ... |
@@ -137,7 +137,7 @@ func (s *Server) makeHTTPHandler(handler httputils.APIFunc) http.HandlerFunc {
|
| 137 | 137 |
} |
| 138 | 138 |
|
| 139 | 139 |
if err := handlerFunc(ctx, w, r, vars); err != nil {
|
| 140 |
- logrus.Errorf("Handler for %s %s returned error: %v", r.Method, r.URL.Path, err)
|
|
| 140 |
+ logrus.Errorf("Handler for %s %s returned error: %+v", r.Method, r.URL.Path, err)
|
|
| 141 | 141 |
httputils.MakeErrorHandler(err)(w, r) |
| 142 | 142 |
} |
| 143 | 143 |
} |
| ... | ... |
@@ -914,6 +914,94 @@ _docker_build() {
|
| 914 | 914 |
} |
| 915 | 915 |
|
| 916 | 916 |
|
| 917 |
+_docker_checkpoint() {
|
|
| 918 |
+ local subcommands=" |
|
| 919 |
+ create |
|
| 920 |
+ ls |
|
| 921 |
+ rm |
|
| 922 |
+ " |
|
| 923 |
+ local aliases=" |
|
| 924 |
+ list |
|
| 925 |
+ remove |
|
| 926 |
+ " |
|
| 927 |
+ __docker_subcommands "$subcommands $aliases" && return |
|
| 928 |
+ |
|
| 929 |
+ case "$cur" in |
|
| 930 |
+ -*) |
|
| 931 |
+ COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) |
|
| 932 |
+ ;; |
|
| 933 |
+ *) |
|
| 934 |
+ COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) ) |
|
| 935 |
+ ;; |
|
| 936 |
+ esac |
|
| 937 |
+} |
|
| 938 |
+ |
|
| 939 |
+_docker_checkpoint_create() {
|
|
| 940 |
+ case "$prev" in |
|
| 941 |
+ --checkpoint-dir) |
|
| 942 |
+ _filedir -d |
|
| 943 |
+ return |
|
| 944 |
+ ;; |
|
| 945 |
+ esac |
|
| 946 |
+ |
|
| 947 |
+ case "$cur" in |
|
| 948 |
+ -*) |
|
| 949 |
+ COMPREPLY=( $( compgen -W "--checkpoint-dir --help --leave-running" -- "$cur" ) ) |
|
| 950 |
+ ;; |
|
| 951 |
+ *) |
|
| 952 |
+ local counter=$(__docker_pos_first_nonflag '--checkpoint-dir') |
|
| 953 |
+ if [ $cword -eq $counter ]; then |
|
| 954 |
+ __docker_complete_containers_running |
|
| 955 |
+ fi |
|
| 956 |
+ ;; |
|
| 957 |
+ esac |
|
| 958 |
+} |
|
| 959 |
+ |
|
| 960 |
+_docker_checkpoint_ls() {
|
|
| 961 |
+ case "$prev" in |
|
| 962 |
+ --checkpoint-dir) |
|
| 963 |
+ _filedir -d |
|
| 964 |
+ return |
|
| 965 |
+ ;; |
|
| 966 |
+ esac |
|
| 967 |
+ |
|
| 968 |
+ case "$cur" in |
|
| 969 |
+ -*) |
|
| 970 |
+ COMPREPLY=( $( compgen -W "--checkpoint-dir --help" -- "$cur" ) ) |
|
| 971 |
+ ;; |
|
| 972 |
+ *) |
|
| 973 |
+ local counter=$(__docker_pos_first_nonflag '--checkpoint-dir') |
|
| 974 |
+ if [ $cword -eq $counter ]; then |
|
| 975 |
+ __docker_complete_containers_all |
|
| 976 |
+ fi |
|
| 977 |
+ ;; |
|
| 978 |
+ esac |
|
| 979 |
+} |
|
| 980 |
+ |
|
| 981 |
+_docker_checkpoint_rm() {
|
|
| 982 |
+ case "$prev" in |
|
| 983 |
+ --checkpoint-dir) |
|
| 984 |
+ _filedir -d |
|
| 985 |
+ return |
|
| 986 |
+ ;; |
|
| 987 |
+ esac |
|
| 988 |
+ |
|
| 989 |
+ case "$cur" in |
|
| 990 |
+ -*) |
|
| 991 |
+ COMPREPLY=( $( compgen -W "--checkpoint-dir --help" -- "$cur" ) ) |
|
| 992 |
+ ;; |
|
| 993 |
+ *) |
|
| 994 |
+ local counter=$(__docker_pos_first_nonflag '--checkpoint-dir') |
|
| 995 |
+ if [ $cword -eq $counter ]; then |
|
| 996 |
+ __docker_complete_containers_all |
|
| 997 |
+ elif [ $cword -eq $(($counter + 1)) ]; then |
|
| 998 |
+ COMPREPLY=( $( compgen -W "$(__docker_q checkpoint ls "$prev" | sed 1d)" -- "$cur" ) ) |
|
| 999 |
+ fi |
|
| 1000 |
+ ;; |
|
| 1001 |
+ esac |
|
| 1002 |
+} |
|
| 1003 |
+ |
|
| 1004 |
+ |
|
| 917 | 1005 |
_docker_container() {
|
| 918 | 1006 |
local subcommands=" |
| 919 | 1007 |
attach |
| ... | ... |
@@ -1600,9 +1688,25 @@ _docker_container_run() {
|
| 1600 | 1600 |
_docker_container_start() {
|
| 1601 | 1601 |
__docker_complete_detach-keys && return |
| 1602 | 1602 |
|
| 1603 |
+ case "$prev" in |
|
| 1604 |
+ --checkpoint) |
|
| 1605 |
+ if [ __docker_is_experimental ] ; then |
|
| 1606 |
+ return |
|
| 1607 |
+ fi |
|
| 1608 |
+ ;; |
|
| 1609 |
+ --checkpoint-dir) |
|
| 1610 |
+ if [ __docker_is_experimental ] ; then |
|
| 1611 |
+ _filedir -d |
|
| 1612 |
+ return |
|
| 1613 |
+ fi |
|
| 1614 |
+ ;; |
|
| 1615 |
+ esac |
|
| 1616 |
+ |
|
| 1603 | 1617 |
case "$cur" in |
| 1604 | 1618 |
-*) |
| 1605 |
- COMPREPLY=( $( compgen -W "--attach -a --detach-keys --help --interactive -i" -- "$cur" ) ) |
|
| 1619 |
+ local options="--attach -a --detach-keys --help --interactive -i" |
|
| 1620 |
+ __docker_is_experimental && options+=" --checkpoint --checkpoint-dir" |
|
| 1621 |
+ COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) |
|
| 1606 | 1622 |
;; |
| 1607 | 1623 |
*) |
| 1608 | 1624 |
__docker_complete_containers_stopped |
| ... | ... |
@@ -4097,6 +4201,7 @@ _docker() {
|
| 4097 | 4097 |
) |
| 4098 | 4098 |
|
| 4099 | 4099 |
local experimental_commands=( |
| 4100 |
+ checkpoint |
|
| 4100 | 4101 |
deploy |
| 4101 | 4102 |
) |
| 4102 | 4103 |
|
| ... | ... |
@@ -4,7 +4,7 @@ |
| 4 | 4 |
# THIS FILE DOES NOT APPLY TO SYSTEMD |
| 5 | 5 |
# |
| 6 | 6 |
# Please see the documentation for "systemd drop-ins": |
| 7 |
-# https://docs.docker.com/engine/articles/systemd/ |
|
| 7 |
+# https://docs.docker.com/engine/admin/systemd/ |
|
| 8 | 8 |
# |
| 9 | 9 |
|
| 10 | 10 |
# Customize location of Docker binary (especially for development testing). |
| ... | ... |
@@ -406,11 +406,17 @@ do_install() {
|
| 406 | 406 |
( set -x; $sh_c 'sleep 3; apt-get install -y -q curl ca-certificates' ) |
| 407 | 407 |
curl='curl -sSL' |
| 408 | 408 |
fi |
| 409 |
- if [ ! -e /usr/bin/gpg ]; then |
|
| 409 |
+ if ! command -v gpg > /dev/null; then |
|
| 410 | 410 |
apt_get_update |
| 411 | 411 |
( set -x; $sh_c 'sleep 3; apt-get install -y -q gnupg2 || apt-get install -y -q gnupg' ) |
| 412 | 412 |
fi |
| 413 | 413 |
|
| 414 |
+ # dirmngr is a separate package in ubuntu yakkety; see https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1634464 |
|
| 415 |
+ if ! command -v dirmngr > /dev/null; then |
|
| 416 |
+ apt_get_update |
|
| 417 |
+ ( set -x; $sh_c 'sleep 3; apt-get install -y -q dirmngr' ) |
|
| 418 |
+ fi |
|
| 419 |
+ |
|
| 414 | 420 |
( |
| 415 | 421 |
set -x |
| 416 | 422 |
for key_server in $key_servers ; do |
| ... | ... |
@@ -237,7 +237,7 @@ func (pm *Manager) save(p *v2.Plugin) error {
|
| 237 | 237 |
return errors.Wrap(err, "failed to marshal plugin json") |
| 238 | 238 |
} |
| 239 | 239 |
if err := ioutils.AtomicWriteFile(filepath.Join(pm.config.Root, p.GetID(), configFileName), pluginJSON, 0600); err != nil {
|
| 240 |
- return err |
|
| 240 |
+ return errors.Wrap(err, "failed to write atomically plugin json") |
|
| 241 | 241 |
} |
| 242 | 242 |
return nil |
| 243 | 243 |
} |
| ... | ... |
@@ -42,12 +42,12 @@ func (pm *Manager) enable(p *v2.Plugin, c *controller, force bool) error {
|
| 42 | 42 |
|
| 43 | 43 |
if p.PropagatedMount != "" {
|
| 44 | 44 |
if err := mount.MakeRShared(p.PropagatedMount); err != nil {
|
| 45 |
- return err |
|
| 45 |
+ return errors.WithStack(err) |
|
| 46 | 46 |
} |
| 47 | 47 |
} |
| 48 | 48 |
|
| 49 | 49 |
if err := initlayer.Setup(filepath.Join(pm.config.Root, p.PluginObj.ID, rootFSFileName), 0, 0); err != nil {
|
| 50 |
- return err |
|
| 50 |
+ return errors.WithStack(err) |
|
| 51 | 51 |
} |
| 52 | 52 |
|
| 53 | 53 |
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 {
|
| 56 | 56 |
logrus.Warnf("Could not unmount %s: %v", p.PropagatedMount, err)
|
| 57 | 57 |
} |
| 58 | 58 |
} |
| 59 |
- return err |
|
| 59 |
+ return errors.WithStack(err) |
|
| 60 | 60 |
} |
| 61 | 61 |
|
| 62 | 62 |
return pm.pluginPostStart(p, c) |
| ... | ... |
@@ -67,7 +67,7 @@ func (pm *Manager) pluginPostStart(p *v2.Plugin, c *controller) error {
|
| 67 | 67 |
if err != nil {
|
| 68 | 68 |
c.restart = false |
| 69 | 69 |
shutdownPlugin(p, c, pm.containerdClient) |
| 70 |
- return err |
|
| 70 |
+ return errors.WithStack(err) |
|
| 71 | 71 |
} |
| 72 | 72 |
|
| 73 | 73 |
p.SetPClient(client) |
| ... | ... |
@@ -3,7 +3,6 @@ |
| 3 | 3 |
package v2 |
| 4 | 4 |
|
| 5 | 5 |
import ( |
| 6 |
- "errors" |
|
| 7 | 6 |
"os" |
| 8 | 7 |
"path/filepath" |
| 9 | 8 |
"strings" |
| ... | ... |
@@ -12,6 +11,7 @@ import ( |
| 12 | 12 |
"github.com/docker/docker/oci" |
| 13 | 13 |
"github.com/docker/docker/pkg/system" |
| 14 | 14 |
specs "github.com/opencontainers/runtime-spec/specs-go" |
| 15 |
+ "github.com/pkg/errors" |
|
| 15 | 16 |
) |
| 16 | 17 |
|
| 17 | 18 |
// InitSpec creates an OCI spec from the plugin's config. |
| ... | ... |
@@ -29,7 +29,7 @@ func (p *Plugin) InitSpec(execRoot string) (*specs.Spec, error) {
|
| 29 | 29 |
|
| 30 | 30 |
execRoot = filepath.Join(execRoot, p.PluginObj.ID) |
| 31 | 31 |
if err := os.MkdirAll(execRoot, 0700); err != nil {
|
| 32 |
- return nil, err |
|
| 32 |
+ return nil, errors.WithStack(err) |
|
| 33 | 33 |
} |
| 34 | 34 |
|
| 35 | 35 |
mounts := append(p.PluginObj.Config.Mounts, types.PluginMount{
|
| ... | ... |
@@ -95,7 +95,7 @@ func (p *Plugin) InitSpec(execRoot string) (*specs.Spec, error) {
|
| 95 | 95 |
path := *dev.Path |
| 96 | 96 |
d, dPermissions, err := oci.DevicesFromPath(path, path, "rwm") |
| 97 | 97 |
if err != nil {
|
| 98 |
- return nil, err |
|
| 98 |
+ return nil, errors.WithStack(err) |
|
| 99 | 99 |
} |
| 100 | 100 |
s.Linux.Devices = append(s.Linux.Devices, d...) |
| 101 | 101 |
s.Linux.Resources.Devices = append(s.Linux.Resources.Devices, dPermissions...) |
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
# the following lines are in sorted order, FYI |
| 2 | 2 |
github.com/Azure/go-ansiterm 388960b655244e76e24c75f48631564eaefade62 |
| 3 | 3 |
github.com/Microsoft/hcsshim v0.5.9 |
| 4 |
-github.com/Microsoft/go-winio v0.3.7 |
|
| 4 |
+github.com/Microsoft/go-winio v0.3.8 |
|
| 5 | 5 |
github.com/Sirupsen/logrus v0.11.0 |
| 6 | 6 |
github.com/davecgh/go-spew 6d212800a42e8ab5c146b8ace3490ee17e5225f9 |
| 7 | 7 |
github.com/docker/libtrust 9cbd2a1374f46905c68a4eb3694a130610adc62a |
| ... | ... |
@@ -339,7 +339,7 @@ func WriteBackupStreamFromTarFile(w io.Writer, t *tar.Reader, hdr *tar.Header) ( |
| 339 | 339 |
bhdr := winio.BackupHeader{
|
| 340 | 340 |
Id: winio.BackupAlternateData, |
| 341 | 341 |
Size: ahdr.Size, |
| 342 |
- Name: ahdr.Name[len(hdr.Name)+1:] + ":$DATA", |
|
| 342 |
+ Name: ahdr.Name[len(hdr.Name):] + ":$DATA", |
|
| 343 | 343 |
} |
| 344 | 344 |
err = bw.WriteHeader(&bhdr) |
| 345 | 345 |
if err != nil {
|