【Docker】/usr/bin/docker-current: Cannot connect to the Docker daemon at unix

3868 ワード

-------------------------------------------------------------------------------------------------
|個人公衆番号zclinuxへようこそnoteはlinuxの使用に関するテクニックを最初に取得します.Linuxの奥義を探る|
-------------------------------------------------------------------------------------------------
エラーは、/usr/bin/docker-current:Cannot connect to the Docker daemon atunix:///var/run/docker.sock. Is the docker daemon running?. See '/usr/bin/docker-current run --help'.
メッセージ内容:
Jul 10 01:07:04 docker systemd: docker.service: main process exited, code=exited, status=1/FAILURE  
Jul 10 01:07:04 docker systemd: Unit docker.service entered failed state.Jul 10 01:07:04 docker systemd: Failed to start Docker Application Container Engine. Jul 10 01:07:04 docker dockerd-current: --label list                            Set key=value labels to the daemon (default []) Jul 10 01:07:04 docker dockerd-current: --live-restore                          Enable live restore of docker when containers are still running Jul 10 01:07:04 docker dockerd-current: --log-driver string                     Default driver for container logs (default "json-file") Jul 10 01:07:04 docker dockerd-current: -l, --log-level string                      Set the logging level ("debug", "info", "warn", "error", "fatal") (default "info")
Jul 10 01:14:10 docker journal: g_simple_action_set_enabled: assertion 'G_IS_SIMPLE_ACTION (simple)' failed Jul 10 01:14:10 docker journal: g_simple_action_set_enabled: assertion 'G_IS_SIMPLE_ACTION (simple)' failed Jul 10 01:14:39 docker journal: g_simple_action_set_enabled: assertion 'G_IS_SIMPLE_ACTION (simple)' failed Jul 10 01:15:27 docker journal: g_simple_action_set_enabled: assertion 'G_IS_SIMPLE_ACTION (simple)' failed Jul 10 01:17:14 docker kube-controller-manager: W0710 01:17:14.365703    9051 reflector.go:319] pkg/controller/garbagecollector/garbagecollector.go:768: watch of ended with: 401: The event in requested index is outdated and cleared (the requested history has been cleared [377/32]) [1376]Jul 10 01:17:39 docker journal: g_simple_action_set_enabled: assertion 'G_IS_SIMPLE_ACTION (simple)' failed  
 
解決策:
/lib/systemd/system/docker.サービスファイル(万全であることを確認し、まず1部バックアップ)
元のファイルの一部の内容:
ExecStart=/usr/bin/dockerd-current \
          --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current \
          --default-runtime=docker-runc \
          --exec-opt native.cgroupdriver=systemd \
          --userland-proxy-path=/usr/libexec/docker/docker-proxy-current \
          --init-path=/usr/libexec/docker/docker-init-current \
          --seccomp-profile=/etc/docker/seccomp.json \
          $OPTIONS \
          $DOCKER_STORAGE_OPTIONS \
          $DOCKER_NETWORK_OPTIONS \
          $ADD_REGISTRY \
          $BLOCK_REGISTRY \
          $INSECURE_REGISTRY \
	  $REGISTRIES

これらの部分はすべて削除されます.
次のように書き直します.
ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock -H tcp://0.0.0.0:7654

その他のパラメータは変更せずにdockerを再起動します
systemctl daemon-reload
systemctl restart docker.service
完了したら、正常に起動しているかどうかを確認し、バージョン情報を表示します.
[root@docker system]# docker version Client:  Version:         1.13.1  API version:     1.26  Package version: docker-1.13.1-96.gitb2f74b2.el7.centos.x86_64  Go version:      go1.10.3  Git commit:      b2f74b2/1.13.1  Built:           Wed May  1 14:55:20 2019  OS/Arch:         linux/amd64
Server:  Version:         1.13.1  API version:     1.26 (minimum version 1.12)  Package version: docker-1.13.1-96.gitb2f74b2.el7.centos.x86_64  Go version:      go1.10.3  Git commit:      b2f74b2/1.13.1  Built:           Wed May  1 14:55:20 2019  OS/Arch:         linux/amd64  Experimental:    false