From c948416313c2a1f65ed083a4df19008c8c5d00ba Mon Sep 17 00:00:00 2001 From: Aleksa Sarai Date: Thu, 29 Nov 2018 20:53:16 +1100 Subject: [PATCH] revert "Remove 'docker-' prefix for containerd and runc binaries" This reverts commit 34eede0296bce6a9c335cb429f10728ae3f4252d, as it would significantly break openSUSE's packaging (as well as causing conflicts between the very-outdated runc that Docker uses and the more up-to-date one available for Podman). Signed-off-by: Aleksa Sarai --- components/engine/api/swagger.yaml | 4 +-- .../builder/builder-next/executor_unix.go | 2 +- components/engine/cmd/dockerd/daemon.go | 36 +++++++------------ .../contrib/docker-machine-install-bundle.sh | 2 +- components/engine/daemon/daemon_unix.go | 6 ++-- .../dockerfile/install/containerd.installer | 6 ++-- .../hack/dockerfile/install/runc.installer | 2 +- components/engine/hack/make/.binary-setup | 8 ++--- .../hack/make/.integration-test-helpers | 2 +- .../engine/integration-cli/check_test.go | 2 +- .../integration-cli/docker_cli_daemon_test.go | 8 ++--- .../engine/internal/test/daemon/daemon.go | 3 +- .../libcontainerd/supervisor/remote_daemon.go | 4 +-- .../supervisor/remote_daemon_linux.go | 4 +-- .../supervisor/remote_daemon_windows.go | 4 +-- 15 files changed, 40 insertions(+), 53 deletions(-) diff --git a/components/engine/api/swagger.yaml b/components/engine/api/swagger.yaml index f58a64f29ea3..d275f2ff49eb 100644 --- a/components/engine/api/swagger.yaml +++ b/components/engine/api/swagger.yaml @@ -3852,10 +3852,10 @@ definitions: $ref: "#/definitions/Runtime" default: runc: - path: "runc" + path: "docker-runc" example: runc: - path: "runc" + path: "docker-runc" runc-master: path: "/go/bin/runc" custom: diff --git a/components/engine/builder/builder-next/executor_unix.go b/components/engine/builder/builder-next/executor_unix.go index b3ea33c05c71..94d8bb766045 100644 --- a/components/engine/builder/builder-next/executor_unix.go +++ b/components/engine/builder/builder-next/executor_unix.go @@ -27,7 +27,7 @@ func newExecutor(root, cgroupParent string, net libnetwork.NetworkController) (e } return runcexecutor.New(runcexecutor.Opt{ Root: filepath.Join(root, "executor"), - CommandCandidates: []string{"runc"}, + CommandCandidates: []string{"docker-runc", "runc"}, DefaultCgroupParent: cgroupParent, }, networkProviders) } diff --git a/components/engine/cmd/dockerd/daemon.go b/components/engine/cmd/dockerd/daemon.go index 839537316af4..05922e6418d0 100644 --- a/components/engine/cmd/dockerd/daemon.go +++ b/components/engine/cmd/dockerd/daemon.go @@ -10,7 +10,6 @@ import ( "strings" "time" - containerddefaults "github.com/containerd/containerd/defaults" "github.com/docker/distribution/uuid" "github.com/docker/docker/api" apiserver "github.com/docker/docker/api/server" @@ -141,25 +140,21 @@ func (cli *DaemonCli) start(opts *daemonOptions) (err error) { ctx, cancel := context.WithCancel(context.Background()) if cli.Config.ContainerdAddr == "" && runtime.GOOS != "windows" { - if !systemContainerdRunning() { - opts, err := cli.getContainerdDaemonOpts() - if err != nil { - cancel() - return fmt.Errorf("Failed to generate containerd options: %v", err) - } - - r, err := supervisor.Start(ctx, filepath.Join(cli.Config.Root, "containerd"), filepath.Join(cli.Config.ExecRoot, "containerd"), opts...) - if err != nil { - cancel() - return fmt.Errorf("Failed to start containerd: %v", err) - } - cli.Config.ContainerdAddr = r.Address() + opts, err := cli.getContainerdDaemonOpts() + if err != nil { + cancel() + return fmt.Errorf("Failed to generate containerd options: %v", err) + } - // Try to wait for containerd to shutdown - defer r.WaitTimeout(10 * time.Second) - } else { - cli.Config.ContainerdAddr = containerddefaults.DefaultAddress + r, err := supervisor.Start(ctx, filepath.Join(cli.Config.Root, "containerd"), filepath.Join(cli.Config.ExecRoot, "containerd"), opts...) + if err != nil { + cancel() + return fmt.Errorf("Failed to start containerd: %v", err) } + cli.Config.ContainerdAddr = r.Address() + + // Try to wait for containerd to shutdown + defer r.WaitTimeout(10 * time.Second) } defer cancel() @@ -665,8 +660,3 @@ func validateAuthzPlugins(requestedPlugins []string, pg plugingetter.PluginGette } return nil } - -func systemContainerdRunning() bool { - _, err := os.Lstat(containerddefaults.DefaultAddress) - return err == nil -} diff --git a/components/engine/contrib/docker-machine-install-bundle.sh b/components/engine/contrib/docker-machine-install-bundle.sh index eff821799c71..860598943bd4 100755 --- a/components/engine/contrib/docker-machine-install-bundle.sh +++ b/components/engine/contrib/docker-machine-install-bundle.sh @@ -31,7 +31,7 @@ bundle_files(){ echo $BUNDLE/binary-daemon/$f fi done - for f in containerd ctr containerd-shim docker-init runc; do + for f in docker-containerd docker-containerd-ctr docker-containerd-shim docker-init docker-runc; do echo $BUNDLE/binary-daemon/$f done if [ -d $BUNDLE/dynbinary-client ]; then diff --git a/components/engine/daemon/daemon_unix.go b/components/engine/daemon/daemon_unix.go index b69eede21c44..77adba94a468 100644 --- a/components/engine/daemon/daemon_unix.go +++ b/components/engine/daemon/daemon_unix.go @@ -54,11 +54,11 @@ import ( const ( // DefaultShimBinary is the default shim to be used by containerd if none // is specified - DefaultShimBinary = "containerd-shim" + DefaultShimBinary = "docker-containerd-shim" // DefaultRuntimeBinary is the default runtime to be used by // containerd if none is specified - DefaultRuntimeBinary = "runc" + DefaultRuntimeBinary = "docker-runc" // See https://git.kernel.org/cgit/linux/kernel/git/tip/tip.git/tree/kernel/sched/sched.h?id=8cd9234c64c584432f6992fe944ca9e46ca8ea76#n269 linuxMinCPUShares = 2 @@ -76,7 +76,7 @@ const ( // DefaultRuntimeName is the default runtime to be used by // containerd if none is specified - DefaultRuntimeName = "runc" + DefaultRuntimeName = "docker-runc" ) type containerGetter interface { diff --git a/components/engine/hack/dockerfile/install/containerd.installer b/components/engine/hack/dockerfile/install/containerd.installer index 4e5680d1ec92..4be15a6abfb8 100755 --- a/components/engine/hack/dockerfile/install/containerd.installer +++ b/components/engine/hack/dockerfile/install/containerd.installer @@ -30,7 +30,7 @@ install_containerd() { mkdir -p ${PREFIX} - cp bin/containerd ${PREFIX}/containerd - cp bin/containerd-shim ${PREFIX}/containerd-shim - cp bin/ctr ${PREFIX}/ctr + cp bin/containerd ${PREFIX}/docker-containerd + cp bin/containerd-shim ${PREFIX}/docker-containerd-shim + cp bin/ctr ${PREFIX}/docker-containerd-ctr } diff --git a/components/engine/hack/dockerfile/install/runc.installer b/components/engine/hack/dockerfile/install/runc.installer index ed483e0f40c6..62263b3c038b 100755 --- a/components/engine/hack/dockerfile/install/runc.installer +++ b/components/engine/hack/dockerfile/install/runc.installer @@ -18,5 +18,5 @@ install_runc() { fi make BUILDTAGS="$RUNC_BUILDTAGS" "$target" mkdir -p ${PREFIX} - cp runc ${PREFIX}/runc + cp runc ${PREFIX}/docker-runc } diff --git a/components/engine/hack/make/.binary-setup b/components/engine/hack/make/.binary-setup index 69bb39b364c6..15de89fe1025 100644 --- a/components/engine/hack/make/.binary-setup +++ b/components/engine/hack/make/.binary-setup @@ -1,9 +1,9 @@ #!/usr/bin/env bash DOCKER_DAEMON_BINARY_NAME='dockerd' -DOCKER_RUNC_BINARY_NAME='runc' -DOCKER_CONTAINERD_BINARY_NAME='containerd' -DOCKER_CONTAINERD_CTR_BINARY_NAME='ctr' -DOCKER_CONTAINERD_SHIM_BINARY_NAME='containerd-shim' +DOCKER_RUNC_BINARY_NAME='docker-runc' +DOCKER_CONTAINERD_BINARY_NAME='docker-containerd' +DOCKER_CONTAINERD_CTR_BINARY_NAME='docker-containerd-ctr' +DOCKER_CONTAINERD_SHIM_BINARY_NAME='docker-containerd-shim' DOCKER_PROXY_BINARY_NAME='docker-proxy' DOCKER_INIT_BINARY_NAME='docker-init' diff --git a/components/engine/hack/make/.integration-test-helpers b/components/engine/hack/make/.integration-test-helpers index 149b6538004c..da2bb7cad2e3 100644 --- a/components/engine/hack/make/.integration-test-helpers +++ b/components/engine/hack/make/.integration-test-helpers @@ -112,7 +112,7 @@ error_on_leaked_containerd_shims() { fi leftovers=$(ps -ax -o pid,cmd | - awk '$2 == "containerd-shim" && $4 ~ /.*\/bundles\/.*\/test-integration/ { print $1 }') + awk '$2 == "docker-containerd-shim" && $4 ~ /.*\/bundles\/.*\/test-integration/ { print $1 }') if [ -n "$leftovers" ]; then ps aux kill -9 $leftovers 2> /dev/null diff --git a/components/engine/integration-cli/check_test.go b/components/engine/integration-cli/check_test.go index 2282967ee569..256b9153d298 100644 --- a/components/engine/integration-cli/check_test.go +++ b/components/engine/integration-cli/check_test.go @@ -32,7 +32,7 @@ const ( privateRegistryURL = registry.DefaultURL // path to containerd's ctr binary - ctrBinary = "ctr" + ctrBinary = "docker-containerd-ctr" // the docker daemon binary to use dockerdBinary = "dockerd" diff --git a/components/engine/integration-cli/docker_cli_daemon_test.go b/components/engine/integration-cli/docker_cli_daemon_test.go index d3cd5f167649..52946738edd7 100644 --- a/components/engine/integration-cli/docker_cli_daemon_test.go +++ b/components/engine/integration-cli/docker_cli_daemon_test.go @@ -44,8 +44,6 @@ import ( "gotest.tools/icmd" ) -const containerdSocket = "/var/run/docker/containerd/containerd.sock" - // TestLegacyDaemonCommand test starting docker daemon using "deprecated" docker daemon // command. Remove this test when we remove this. func (s *DockerDaemonSuite) TestLegacyDaemonCommand(c *check.C) { @@ -1451,7 +1449,7 @@ func (s *DockerDaemonSuite) TestCleanupMountsAfterDaemonAndContainerKill(c *chec c.Assert(d.Kill(), check.IsNil) // kill the container - icmd.RunCommand(ctrBinary, "--address", containerdSocket, + icmd.RunCommand(ctrBinary, "--address", "/var/run/docker/containerd/docker-containerd.sock", "--namespace", moby_daemon.ContainersNamespace, "tasks", "kill", id).Assert(c, icmd.Success) // restart daemon. @@ -1973,7 +1971,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithKilledRunningContainer(t *check } // kill the container - icmd.RunCommand(ctrBinary, "--address", containerdSocket, + icmd.RunCommand(ctrBinary, "--address", "/var/run/docker/containerd/docker-containerd.sock", "--namespace", moby_daemon.ContainersNamespace, "tasks", "kill", cid).Assert(t, icmd.Success) // Give time to containerd to process the command if we don't @@ -2076,7 +2074,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithUnpausedRunningContainer(t *che // resume the container result := icmd.RunCommand( ctrBinary, - "--address", containerdSocket, + "--address", "/var/run/docker/containerd/docker-containerd.sock", "--namespace", moby_daemon.ContainersNamespace, "tasks", "resume", cid) result.Assert(t, icmd.Success) diff --git a/components/engine/internal/test/daemon/daemon.go b/components/engine/internal/test/daemon/daemon.go index 4f56dff9bba8..8c04c3158f7a 100644 --- a/components/engine/internal/test/daemon/daemon.go +++ b/components/engine/internal/test/daemon/daemon.go @@ -38,7 +38,6 @@ type logT interface { } const defaultDockerdBinary = "dockerd" -const containerdSocket = "/var/run/docker/containerd/containerd.sock" var errDaemonNotStarted = errors.New("daemon not started") @@ -225,7 +224,7 @@ func (d *Daemon) StartWithLogFile(out *os.File, providedArgs ...string) error { return errors.Wrapf(err, "[%s] could not find docker binary in $PATH", d.id) } args := append(d.GlobalFlags, - "--containerd", containerdSocket, + "--containerd", "/var/run/docker/containerd/docker-containerd.sock", "--data-root", d.Root, "--exec-root", d.execRoot, "--pidfile", fmt.Sprintf("%s/docker.pid", d.Folder), diff --git a/components/engine/libcontainerd/supervisor/remote_daemon.go b/components/engine/libcontainerd/supervisor/remote_daemon.go index 095300f753e9..1dcfbe176b0d 100644 --- a/components/engine/libcontainerd/supervisor/remote_daemon.go +++ b/components/engine/libcontainerd/supervisor/remote_daemon.go @@ -27,8 +27,8 @@ const ( shutdownTimeout = 15 * time.Second startupTimeout = 15 * time.Second configFile = "containerd.toml" - binaryName = "containerd" - pidFile = "containerd.pid" + binaryName = "docker-containerd" + pidFile = "docker-containerd.pid" ) type pluginConfigs struct { diff --git a/components/engine/libcontainerd/supervisor/remote_daemon_linux.go b/components/engine/libcontainerd/supervisor/remote_daemon_linux.go index 799399c07bc5..1ea91d2b5d0b 100644 --- a/components/engine/libcontainerd/supervisor/remote_daemon_linux.go +++ b/components/engine/libcontainerd/supervisor/remote_daemon_linux.go @@ -11,8 +11,8 @@ import ( ) const ( - sockFile = "containerd.sock" - debugSockFile = "containerd-debug.sock" + sockFile = "docker-containerd.sock" + debugSockFile = "docker-containerd-debug.sock" ) func (r *remote) setDefaults() { diff --git a/components/engine/libcontainerd/supervisor/remote_daemon_windows.go b/components/engine/libcontainerd/supervisor/remote_daemon_windows.go index 9b254ef58a0a..bcdc9529e0f7 100644 --- a/components/engine/libcontainerd/supervisor/remote_daemon_windows.go +++ b/components/engine/libcontainerd/supervisor/remote_daemon_windows.go @@ -7,8 +7,8 @@ import ( ) const ( - grpcPipeName = `\\.\pipe\containerd-containerd` - debugPipeName = `\\.\pipe\containerd-debug` + grpcPipeName = `\\.\pipe\docker-containerd-containerd` + debugPipeName = `\\.\pipe\docker-containerd-debug` ) func (r *remote) setDefaults() { -- 2.19.1