无法在 Ubuntu 中安装 Docker
Can't Install Docker in Ubuntu
我正在尝试使用以下命令 sudo apt install docker.io
在 ubuntu 18.04 中安装 docker。问题是,在完成一些事情后,它实际上开始安装 docker 我收到以下错误:
Created symlink /etc/systemd/system/sockets.target.wants/docker.socket → /lib/systemd/system/docker.socket.
Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xe" for details.
invoke-rc.d: initscript docker, action "start" failed.
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; disabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Wed 2019-11-06 15:24:39 EST; 4ms ago
Docs: https://docs.docker.com
Process: 6303 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
Main PID: 6303 (code=exited, status=1/FAILURE)
我尝试了 systemctl status docker.service
和 journalctl -xe
但无法解决问题,因为我是 linux
的新手
编辑
systemctl status docker.service output:
Loaded: loaded (/lib/systemd/system/docker.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2019-11-07 09:18:38 EST; 6s ago
Docs: https://docs.docker.com
Process: 2819 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
Main PID: 2819 (code=exited, status=1/FAILURE)
Nov 07 09:18:38 alejandro-ThinkPad-E480 systemd[1]: docker.service: Service hold-off time over, scheduling restart.
Nov 07 09:18:38 alejandro-ThinkPad-E480 systemd[1]: docker.service: Scheduled restart job, restart counter is at 4.
Nov 07 09:18:38 alejandro-ThinkPad-E480 systemd[1]: Stopped Docker Application Container Engine.
Nov 07 09:18:38 alejandro-ThinkPad-E480 systemd[1]: docker.service: Start request repeated too quickly.
Nov 07 09:18:38 alejandro-ThinkPad-E480 systemd[1]: docker.service: Failed with result 'exit-code'.
Nov 07 09:18:38 alejandro-ThinkPad-E480 systemd[1]: Failed to start Docker Application Container Engine.
和journalctl -xe
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit docker.socket has finished shutting down.
Nov 07 09:18:38 alejandro-ThinkPad-E480 systemd[1]: Stopping Docker Socket for the API.
-- Subject: Unit docker.socket has begun shutting down
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit docker.socket has begun shutting down.
Nov 07 09:18:38 alejandro-ThinkPad-E480 systemd[1]: Starting Docker Socket for the API.
-- Subject: Unit docker.socket has begun start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit docker.socket has begun starting up.
Nov 07 09:18:38 alejandro-ThinkPad-E480 systemd[1]: Listening on Docker Socket for the API.
-- Subject: Unit docker.socket has finished start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit docker.socket has finished starting up.
--
-- The start-up result is RESULT.
Nov 07 09:18:38 alejandro-ThinkPad-E480 systemd[1]: docker.service: Start request repeated too quickly.
Nov 07 09:18:38 alejandro-ThinkPad-E480 systemd[1]: docker.service: Failed with result 'exit-code'.
Nov 07 09:18:38 alejandro-ThinkPad-E480 systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit docker.service has failed.
--
-- The result is RESULT.
Nov 07 09:18:38 alejandro-ThinkPad-E480 systemd[1]: docker.socket: Failed with result 'service-start-limit-hit'.
Nov 07 09:19:26 alejandro-ThinkPad-E480 pkexec[2910]: pam_unix(polkit-1:session): session opened for user root by (uid=1000)
Nov 07 09:19:26 alejandro-ThinkPad-E480 pkexec[2910]: alejandro: Executing command [USER=root] [TTY=unknown] [CWD=/home/alejandro] [COMMAND=/usr/lib/u
试试这个方法:
sudo apt-get update
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
sudo apt update
apt-cache policy docker-ce
sudo apt install docker-ce
安装docker-compose
sudo apt-get install docker-compose
如果你有非 0 结束 return 错误然后停止 docker servie first
systemctl stop docker
安装compose后重新启动
systemctl start docker
检查 docker 是否为 运行
sudo systemctl status docker
sudo docker run hello-world
我已尝试在 Ubuntu 上安装 Docker,但出现了如下相同的错误:
invoke-rc.d: initscript docker, action "start" failed.
docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Wed 2020-01-08 09:41:04 KST; 11ms ago
Docs: https://docs.docker.com
Process: 3644 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
Main PID: 3644 (code=exited, status=1/FAILURE)
dpkg: error processing package docker-ce (--configure):
installed docker-ce package post-installation script subprocess returned error exit status 1
如果用户不在 'adm' 组中,"journalctl -xe" 不会显示所有消息。
"sudo journalctl -xe" 显示以下消息:
1월 08 09:41:03 kdndemo-desktop groupadd[3451]: group added to /etc/group: name=docker, GID=999
1월 08 09:41:03 kdndemo-desktop groupadd[3451]: group added to /etc/gshadow: name=docker
1월 08 09:41:03 kdndemo-desktop groupadd[3451]: new group: name=docker, GID=999
1월 08 09:41:03 kdndemo-desktop systemd[1]: Reloading.
1월 08 09:41:03 kdndemo-desktop systemd[1]: Starting Daily apt download activities...
1월 08 09:41:03 kdndemo-desktop systemd[1]: Started Daily apt download activities.
1월 08 09:41:03 kdndemo-desktop systemd[1]: Reloading.
1월 08 09:41:04 kdndemo-desktop systemd[1]: Reloading.
1월 08 09:41:04 kdndemo-desktop systemd[1]: Reloading.
1월 08 09:41:04 kdndemo-desktop systemd[1]: Starting Docker Application Container Engine...
1월 08 09:41:04 kdndemo-desktop dockerd[3644]: time="2020-01-08T09:41:04.683235561+09:00" level=info msg="Starting up"
1월 08 09:41:04 kdndemo-desktop dockerd[3644]: failed to load listeners: no sockets found via socket activation: make sure the service was started by systemd
1월 08 09:41:04 kdndemo-desktop systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
1월 08 09:41:04 kdndemo-desktop systemd[1]: docker.service: Failed with result 'exit-code'.
1월 08 09:41:04 kdndemo-desktop systemd[1]: Failed to start Docker Application Container Engine.
就我而言,我通过在 /etc/group 中向我的帐户添加一个组来解决它。
sudo:x:27:nini
我正在尝试使用以下命令 sudo apt install docker.io
在 ubuntu 18.04 中安装 docker。问题是,在完成一些事情后,它实际上开始安装 docker 我收到以下错误:
Created symlink /etc/systemd/system/sockets.target.wants/docker.socket → /lib/systemd/system/docker.socket.
Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xe" for details.
invoke-rc.d: initscript docker, action "start" failed.
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; disabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Wed 2019-11-06 15:24:39 EST; 4ms ago
Docs: https://docs.docker.com
Process: 6303 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
Main PID: 6303 (code=exited, status=1/FAILURE)
我尝试了 systemctl status docker.service
和 journalctl -xe
但无法解决问题,因为我是 linux
编辑
systemctl status docker.service output:
Loaded: loaded (/lib/systemd/system/docker.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2019-11-07 09:18:38 EST; 6s ago
Docs: https://docs.docker.com
Process: 2819 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
Main PID: 2819 (code=exited, status=1/FAILURE)
Nov 07 09:18:38 alejandro-ThinkPad-E480 systemd[1]: docker.service: Service hold-off time over, scheduling restart.
Nov 07 09:18:38 alejandro-ThinkPad-E480 systemd[1]: docker.service: Scheduled restart job, restart counter is at 4.
Nov 07 09:18:38 alejandro-ThinkPad-E480 systemd[1]: Stopped Docker Application Container Engine.
Nov 07 09:18:38 alejandro-ThinkPad-E480 systemd[1]: docker.service: Start request repeated too quickly.
Nov 07 09:18:38 alejandro-ThinkPad-E480 systemd[1]: docker.service: Failed with result 'exit-code'.
Nov 07 09:18:38 alejandro-ThinkPad-E480 systemd[1]: Failed to start Docker Application Container Engine.
和journalctl -xe
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit docker.socket has finished shutting down.
Nov 07 09:18:38 alejandro-ThinkPad-E480 systemd[1]: Stopping Docker Socket for the API.
-- Subject: Unit docker.socket has begun shutting down
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit docker.socket has begun shutting down.
Nov 07 09:18:38 alejandro-ThinkPad-E480 systemd[1]: Starting Docker Socket for the API.
-- Subject: Unit docker.socket has begun start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit docker.socket has begun starting up.
Nov 07 09:18:38 alejandro-ThinkPad-E480 systemd[1]: Listening on Docker Socket for the API.
-- Subject: Unit docker.socket has finished start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit docker.socket has finished starting up.
--
-- The start-up result is RESULT.
Nov 07 09:18:38 alejandro-ThinkPad-E480 systemd[1]: docker.service: Start request repeated too quickly.
Nov 07 09:18:38 alejandro-ThinkPad-E480 systemd[1]: docker.service: Failed with result 'exit-code'.
Nov 07 09:18:38 alejandro-ThinkPad-E480 systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit docker.service has failed.
--
-- The result is RESULT.
Nov 07 09:18:38 alejandro-ThinkPad-E480 systemd[1]: docker.socket: Failed with result 'service-start-limit-hit'.
Nov 07 09:19:26 alejandro-ThinkPad-E480 pkexec[2910]: pam_unix(polkit-1:session): session opened for user root by (uid=1000)
Nov 07 09:19:26 alejandro-ThinkPad-E480 pkexec[2910]: alejandro: Executing command [USER=root] [TTY=unknown] [CWD=/home/alejandro] [COMMAND=/usr/lib/u
试试这个方法:
sudo apt-get update
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
sudo apt update
apt-cache policy docker-ce
sudo apt install docker-ce
安装docker-compose
sudo apt-get install docker-compose
如果你有非 0 结束 return 错误然后停止 docker servie first
systemctl stop docker
安装compose后重新启动
systemctl start docker
检查 docker 是否为 运行
sudo systemctl status docker
sudo docker run hello-world
我已尝试在 Ubuntu 上安装 Docker,但出现了如下相同的错误:
invoke-rc.d: initscript docker, action "start" failed.
docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Wed 2020-01-08 09:41:04 KST; 11ms ago
Docs: https://docs.docker.com
Process: 3644 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
Main PID: 3644 (code=exited, status=1/FAILURE)
dpkg: error processing package docker-ce (--configure):
installed docker-ce package post-installation script subprocess returned error exit status 1
如果用户不在 'adm' 组中,"journalctl -xe" 不会显示所有消息。
"sudo journalctl -xe" 显示以下消息:
1월 08 09:41:03 kdndemo-desktop groupadd[3451]: group added to /etc/group: name=docker, GID=999
1월 08 09:41:03 kdndemo-desktop groupadd[3451]: group added to /etc/gshadow: name=docker
1월 08 09:41:03 kdndemo-desktop groupadd[3451]: new group: name=docker, GID=999
1월 08 09:41:03 kdndemo-desktop systemd[1]: Reloading.
1월 08 09:41:03 kdndemo-desktop systemd[1]: Starting Daily apt download activities...
1월 08 09:41:03 kdndemo-desktop systemd[1]: Started Daily apt download activities.
1월 08 09:41:03 kdndemo-desktop systemd[1]: Reloading.
1월 08 09:41:04 kdndemo-desktop systemd[1]: Reloading.
1월 08 09:41:04 kdndemo-desktop systemd[1]: Reloading.
1월 08 09:41:04 kdndemo-desktop systemd[1]: Starting Docker Application Container Engine...
1월 08 09:41:04 kdndemo-desktop dockerd[3644]: time="2020-01-08T09:41:04.683235561+09:00" level=info msg="Starting up"
1월 08 09:41:04 kdndemo-desktop dockerd[3644]: failed to load listeners: no sockets found via socket activation: make sure the service was started by systemd
1월 08 09:41:04 kdndemo-desktop systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
1월 08 09:41:04 kdndemo-desktop systemd[1]: docker.service: Failed with result 'exit-code'.
1월 08 09:41:04 kdndemo-desktop systemd[1]: Failed to start Docker Application Container Engine.
就我而言,我通过在 /etc/group 中向我的帐户添加一个组来解决它。
sudo:x:27:nini