From 1f027b4d1b69f7949ea01d1fa916bf98c737c9bb Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Mon, 8 Jan 2018 12:01:03 -0500 Subject: [PATCH 1/3] Honor DOCKER_RAMDISK with containerd 1.0 Signed-off-by: Michael Crosby Upstream-commit: 54051e9e64185e442e034c7e49a5707459a9eed2 Component: engine --- components/engine/libcontainerd/client_daemon.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/engine/libcontainerd/client_daemon.go b/components/engine/libcontainerd/client_daemon.go index 7508968fd5..fd321e0750 100644 --- a/components/engine/libcontainerd/client_daemon.go +++ b/components/engine/libcontainerd/client_daemon.go @@ -262,8 +262,9 @@ func (c *client) Start(ctx context.Context, id, checkpointDir string, withStdin func(_ context.Context, _ *containerd.Client, info *containerd.TaskInfo) error { info.Checkpoint = cp info.Options = &runctypes.CreateOptions{ - IoUid: uint32(uid), - IoGid: uint32(gid), + IoUid: uint32(uid), + IoGid: uint32(gid), + NoPivotRoot: os.Getenv("DOCKER_RAMDISK") != "", } return nil }) From 844b65b1817f56cba0a33b8d142eb667bbcc8bf3 Mon Sep 17 00:00:00 2001 From: Yong Tang Date: Mon, 8 Jan 2018 18:29:59 +0000 Subject: [PATCH 2/3] Update doc for CopyFromContainer This fix updates doc for CopyFromContainer to explicitly mention that the content received from the reader is a TAR archive. This fix closes 35965. Signed-off-by: Yong Tang Upstream-commit: e330e7a5ce77736c76c36ba77983accfae01c405 Component: engine --- components/engine/client/container_copy.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/engine/client/container_copy.go b/components/engine/client/container_copy.go index 30ba6803f0..b7d5252ab2 100644 --- a/components/engine/client/container_copy.go +++ b/components/engine/client/container_copy.go @@ -30,7 +30,7 @@ func (cli *Client) ContainerStatPath(ctx context.Context, containerID, path stri } // CopyToContainer copies content into the container filesystem. -// Note that `content` must be a Reader for a TAR +// Note that `content` must be a Reader for a TAR archive func (cli *Client) CopyToContainer(ctx context.Context, container, path string, content io.Reader, options types.CopyToContainerOptions) error { query := url.Values{} query.Set("path", filepath.ToSlash(path)) // Normalize the paths used in the API. @@ -59,7 +59,7 @@ func (cli *Client) CopyToContainer(ctx context.Context, container, path string, } // CopyFromContainer gets the content from the container and returns it as a Reader -// to manipulate it in the host. It's up to the caller to close the reader. +// for a TAR archive to manipulate it in the host. It's up to the caller to close the reader. func (cli *Client) CopyFromContainer(ctx context.Context, container, srcPath string) (io.ReadCloser, types.ContainerPathStat, error) { query := make(url.Values, 1) query.Set("path", filepath.ToSlash(srcPath)) // Normalize the paths used in the API. From 88fc1465469ee0d344186d97f395e344bfa8b34a Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Mon, 8 Jan 2018 14:32:39 -0500 Subject: [PATCH 3/3] Use errdefs instead of string contains for checking not found Signed-off-by: Daniel Nephin Upstream-commit: 9b62d4ffa39f7c042f94f9a3670cae2a816535da Component: engine --- components/engine/libcontainerd/client_daemon.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/engine/libcontainerd/client_daemon.go b/components/engine/libcontainerd/client_daemon.go index 7508968fd5..0c0939df10 100644 --- a/components/engine/libcontainerd/client_daemon.go +++ b/components/engine/libcontainerd/client_daemon.go @@ -147,7 +147,7 @@ func (c *client) Restore(ctx context.Context, id string, attachStdio StdioCallba rio, err = attachStdio(io) return rio, err }) - if err != nil && !strings.Contains(err.Error(), "no running task found") { + if err != nil && !errdefs.IsNotFound(errors.Cause(err)) { return false, -1, err }