diff --git a/api/swagger.yaml b/api/swagger.yaml index 54871c6f53e7c..10076632cc5eb 100644 --- a/api/swagger.yaml +++ b/api/swagger.yaml @@ -3848,10 +3848,10 @@ definitions: $ref: "#/definitions/Runtime" default: runc: - path: "docker-runc" + path: "runc" example: runc: - path: "docker-runc" + path: "runc" runc-master: path: "/go/bin/runc" custom: diff --git a/builder/builder-next/executor_unix.go b/builder/builder-next/executor_unix.go index 94d8bb766045e..b3ea33c05c71f 100644 --- a/builder/builder-next/executor_unix.go +++ b/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{"docker-runc", "runc"}, + CommandCandidates: []string{"runc"}, DefaultCgroupParent: cgroupParent, }, networkProviders) } diff --git a/cmd/dockerd/daemon.go b/cmd/dockerd/daemon.go index aba6b1e06c4b9..839537316af46 100644 --- a/cmd/dockerd/daemon.go +++ b/cmd/dockerd/daemon.go @@ -10,6 +10,7 @@ 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" @@ -140,22 +141,25 @@ func (cli *DaemonCli) start(opts *daemonOptions) (err error) { ctx, cancel := context.WithCancel(context.Background()) if cli.Config.ContainerdAddr == "" && runtime.GOOS != "windows" { - 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) - } + if !systemContainerdRunning() { + opts, err := cli.getContainerdDaemonOpts() + if err != nil { + cancel() + return fmt.Errorf("Failed to generate containerd options: %v", err) + } - cli.Config.ContainerdAddr = r.Address() + 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) + // Try to wait for containerd to shutdown + defer r.WaitTimeout(10 * time.Second) + } else { + cli.Config.ContainerdAddr = containerddefaults.DefaultAddress + } } defer cancel() @@ -661,3 +665,8 @@ func validateAuthzPlugins(requestedPlugins []string, pg plugingetter.PluginGette } return nil } + +func systemContainerdRunning() bool { + _, err := os.Lstat(containerddefaults.DefaultAddress) + return err == nil +} diff --git a/contrib/docker-machine-install-bundle.sh b/contrib/docker-machine-install-bundle.sh index 860598943bd47..eff821799c716 100755 --- a/contrib/docker-machine-install-bundle.sh +++ b/contrib/docker-machine-install-bundle.sh @@ -31,7 +31,7 @@ bundle_files(){ echo $BUNDLE/binary-daemon/$f fi done - for f in docker-containerd docker-containerd-ctr docker-containerd-shim docker-init docker-runc; do + for f in containerd ctr containerd-shim docker-init runc; do echo $BUNDLE/binary-daemon/$f done if [ -d $BUNDLE/dynbinary-client ]; then diff --git a/daemon/daemon_unix.go b/daemon/daemon_unix.go index c4fc72cedb2a0..07f88786fae8b 100644 --- a/daemon/daemon_unix.go +++ b/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 = "docker-containerd-shim" + DefaultShimBinary = "containerd-shim" // DefaultRuntimeBinary is the default runtime to be used by // containerd if none is specified - DefaultRuntimeBinary = "docker-runc" + DefaultRuntimeBinary = "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 = "docker-runc" + DefaultRuntimeName = "runc" ) type containerGetter interface { diff --git a/hack/dockerfile/install/containerd.installer b/hack/dockerfile/install/containerd.installer index 4be15a6abfb8b..4e5680d1ec92e 100755 --- a/hack/dockerfile/install/containerd.installer +++ b/hack/dockerfile/install/containerd.installer @@ -30,7 +30,7 @@ install_containerd() { mkdir -p ${PREFIX} - cp bin/containerd ${PREFIX}/docker-containerd - cp bin/containerd-shim ${PREFIX}/docker-containerd-shim - cp bin/ctr ${PREFIX}/docker-containerd-ctr + cp bin/containerd ${PREFIX}/containerd + cp bin/containerd-shim ${PREFIX}/containerd-shim + cp bin/ctr ${PREFIX}/ctr } diff --git a/hack/dockerfile/install/runc.installer b/hack/dockerfile/install/runc.installer index 62263b3c038b6..ed483e0f40c65 100755 --- a/hack/dockerfile/install/runc.installer +++ b/hack/dockerfile/install/runc.installer @@ -18,5 +18,5 @@ install_runc() { fi make BUILDTAGS="$RUNC_BUILDTAGS" "$target" mkdir -p ${PREFIX} - cp runc ${PREFIX}/docker-runc + cp runc ${PREFIX}/runc } diff --git a/hack/make/.binary-setup b/hack/make/.binary-setup index 15de89fe10253..69bb39b364c6e 100644 --- a/hack/make/.binary-setup +++ b/hack/make/.binary-setup @@ -1,9 +1,9 @@ #!/usr/bin/env bash DOCKER_DAEMON_BINARY_NAME='dockerd' -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_RUNC_BINARY_NAME='runc' +DOCKER_CONTAINERD_BINARY_NAME='containerd' +DOCKER_CONTAINERD_CTR_BINARY_NAME='ctr' +DOCKER_CONTAINERD_SHIM_BINARY_NAME='containerd-shim' DOCKER_PROXY_BINARY_NAME='docker-proxy' DOCKER_INIT_BINARY_NAME='docker-init' diff --git a/hack/make/.integration-test-helpers b/hack/make/.integration-test-helpers index da2bb7cad2e36..149b6538004c2 100644 --- a/hack/make/.integration-test-helpers +++ b/hack/make/.integration-test-helpers @@ -112,7 +112,7 @@ error_on_leaked_containerd_shims() { fi leftovers=$(ps -ax -o pid,cmd | - awk '$2 == "docker-containerd-shim" && $4 ~ /.*\/bundles\/.*\/test-integration/ { print $1 }') + awk '$2 == "containerd-shim" && $4 ~ /.*\/bundles\/.*\/test-integration/ { print $1 }') if [ -n "$leftovers" ]; then ps aux kill -9 $leftovers 2> /dev/null diff --git a/hack/make/binary-daemon b/hack/make/binary-daemon index f68163636b26b..c1a6e6f9ed5fd 100644 --- a/hack/make/binary-daemon +++ b/hack/make/binary-daemon @@ -10,14 +10,14 @@ copy_binaries() { if [ "$(go env GOOS)/$(go env GOARCH)" != "$(go env GOHOSTOS)/$(go env GOHOSTARCH)" ]; then return fi - if [ ! -x /usr/local/bin/docker-runc ]; then + if [ ! -x /usr/local/bin/runc ]; then return fi echo "Copying nested executables into $dir" - for file in containerd containerd-shim containerd-ctr runc init proxy; do - cp -f `which "docker-$file"` "$dir/" + for file in containerd containerd-shim ctr runc docker-init docker-proxy; do + cp -f `which "$file"` "$dir/" if [ "$hash" == "hash" ]; then - hash_files "$dir/docker-$file" + hash_files "$dir/$file" fi done } diff --git a/integration-cli/check_test.go b/integration-cli/check_test.go index 256b9153d2987..2282967ee5695 100644 --- a/integration-cli/check_test.go +++ b/integration-cli/check_test.go @@ -32,7 +32,7 @@ const ( privateRegistryURL = registry.DefaultURL // path to containerd's ctr binary - ctrBinary = "docker-containerd-ctr" + ctrBinary = "ctr" // the docker daemon binary to use dockerdBinary = "dockerd" diff --git a/integration-cli/docker_cli_daemon_test.go b/integration-cli/docker_cli_daemon_test.go index edb2a7b6c94cc..d3cd5f1676490 100644 --- a/integration-cli/docker_cli_daemon_test.go +++ b/integration-cli/docker_cli_daemon_test.go @@ -44,6 +44,8 @@ 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) { @@ -1449,7 +1451,7 @@ func (s *DockerDaemonSuite) TestCleanupMountsAfterDaemonAndContainerKill(c *chec c.Assert(d.Kill(), check.IsNil) // kill the container - icmd.RunCommand(ctrBinary, "--address", "/var/run/docker/containerd/docker-containerd.sock", + icmd.RunCommand(ctrBinary, "--address", containerdSocket, "--namespace", moby_daemon.ContainersNamespace, "tasks", "kill", id).Assert(c, icmd.Success) // restart daemon. @@ -1971,7 +1973,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithKilledRunningContainer(t *check } // kill the container - icmd.RunCommand(ctrBinary, "--address", "/var/run/docker/containerd/docker-containerd.sock", + icmd.RunCommand(ctrBinary, "--address", containerdSocket, "--namespace", moby_daemon.ContainersNamespace, "tasks", "kill", cid).Assert(t, icmd.Success) // Give time to containerd to process the command if we don't @@ -2074,7 +2076,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithUnpausedRunningContainer(t *che // resume the container result := icmd.RunCommand( ctrBinary, - "--address", "/var/run/docker/containerd/docker-containerd.sock", + "--address", containerdSocket, "--namespace", moby_daemon.ContainersNamespace, "tasks", "resume", cid) result.Assert(t, icmd.Success) @@ -2409,7 +2411,7 @@ func (s *DockerDaemonSuite) TestRunWithRuntimeFromConfigFile(c *check.C) { { "runtimes": { "oci": { - "path": "docker-runc" + "path": "runc" }, "vm": { "path": "/usr/local/bin/vm-manager", @@ -2491,7 +2493,7 @@ func (s *DockerDaemonSuite) TestRunWithRuntimeFromConfigFile(c *check.C) { "default-runtime": "vm", "runtimes": { "oci": { - "path": "docker-runc" + "path": "runc" }, "vm": { "path": "/usr/local/bin/vm-manager", @@ -2517,7 +2519,7 @@ func (s *DockerDaemonSuite) TestRunWithRuntimeFromConfigFile(c *check.C) { } func (s *DockerDaemonSuite) TestRunWithRuntimeFromCommandLine(c *check.C) { - s.d.StartWithBusybox(c, "--add-runtime", "oci=docker-runc", "--add-runtime", "vm=/usr/local/bin/vm-manager") + s.d.StartWithBusybox(c, "--add-runtime", "oci=runc", "--add-runtime", "vm=/usr/local/bin/vm-manager") // Run with default runtime out, err := s.d.Cmd("run", "--rm", "busybox", "ls") @@ -2564,7 +2566,7 @@ func (s *DockerDaemonSuite) TestRunWithRuntimeFromCommandLine(c *check.C) { // Check that we can select a default runtime s.d.Stop(c) - s.d.StartWithBusybox(c, "--default-runtime=vm", "--add-runtime", "oci=docker-runc", "--add-runtime", "vm=/usr/local/bin/vm-manager") + s.d.StartWithBusybox(c, "--default-runtime=vm", "--add-runtime", "oci=runc", "--add-runtime", "vm=/usr/local/bin/vm-manager") out, err = s.d.Cmd("run", "--rm", "busybox", "ls") c.Assert(err, check.NotNil, check.Commentf("%s", out)) diff --git a/internal/test/daemon/daemon.go b/internal/test/daemon/daemon.go index 8c04c3158f7a9..4f56dff9bba8c 100644 --- a/internal/test/daemon/daemon.go +++ b/internal/test/daemon/daemon.go @@ -38,6 +38,7 @@ type logT interface { } const defaultDockerdBinary = "dockerd" +const containerdSocket = "/var/run/docker/containerd/containerd.sock" var errDaemonNotStarted = errors.New("daemon not started") @@ -224,7 +225,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", "/var/run/docker/containerd/docker-containerd.sock", + "--containerd", containerdSocket, "--data-root", d.Root, "--exec-root", d.execRoot, "--pidfile", fmt.Sprintf("%s/docker.pid", d.Folder), diff --git a/libcontainerd/supervisor/remote_daemon.go b/libcontainerd/supervisor/remote_daemon.go index 1dcfbe176b0de..095300f753e97 100644 --- a/libcontainerd/supervisor/remote_daemon.go +++ b/libcontainerd/supervisor/remote_daemon.go @@ -27,8 +27,8 @@ const ( shutdownTimeout = 15 * time.Second startupTimeout = 15 * time.Second configFile = "containerd.toml" - binaryName = "docker-containerd" - pidFile = "docker-containerd.pid" + binaryName = "containerd" + pidFile = "containerd.pid" ) type pluginConfigs struct { diff --git a/libcontainerd/supervisor/remote_daemon_linux.go b/libcontainerd/supervisor/remote_daemon_linux.go index 1ea91d2b5d0b7..799399c07bc58 100644 --- a/libcontainerd/supervisor/remote_daemon_linux.go +++ b/libcontainerd/supervisor/remote_daemon_linux.go @@ -11,8 +11,8 @@ import ( ) const ( - sockFile = "docker-containerd.sock" - debugSockFile = "docker-containerd-debug.sock" + sockFile = "containerd.sock" + debugSockFile = "containerd-debug.sock" ) func (r *remote) setDefaults() { diff --git a/libcontainerd/supervisor/remote_daemon_windows.go b/libcontainerd/supervisor/remote_daemon_windows.go index bcdc9529e0f78..9b254ef58a0aa 100644 --- a/libcontainerd/supervisor/remote_daemon_windows.go +++ b/libcontainerd/supervisor/remote_daemon_windows.go @@ -7,8 +7,8 @@ import ( ) const ( - grpcPipeName = `\\.\pipe\docker-containerd-containerd` - debugPipeName = `\\.\pipe\docker-containerd-debug` + grpcPipeName = `\\.\pipe\containerd-containerd` + debugPipeName = `\\.\pipe\containerd-debug` ) func (r *remote) setDefaults() {