无法在 Ubuntu 17.10 上安装 Docker

无法在 Ubuntu 17.10 上安装 Docker

因此,我花了一整天时间尝试安装 docker。这是我一直遇到的错误。我使用了 docker 的官方方法,还尝试了 digital ocean 安装指南。

Setting up docker-ce (18.04.0~ce~3-0~ubuntu) ...
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; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Thu 2018-04-19 17:33:13 GMT; 10ms ago
     Docs: https://docs.docker.com
  Process: 6283 ExecStart=/usr/bin/dockerd -H fd:// (code=exited, status=1/FAILURE) ## i suspect this line in service file
 Main PID: 6283 (code=exited, status=1/FAILURE)
      CPU: 201ms

Apr 19 17:33:13 sav-subsystems systemd[1]: docker.service: Unit entered failed state.
Apr 19 17:33:13 sav-subsystems systemd[1]: docker.service: Failed with result 'exit-code'.
dpkg: error processing package docker-ce (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 docker-ce
E: Sub-process /usr/bin/dpkg returned an error code (1)

重新启动并记录错误后:我得到了这个->

-- Unit docker.socket has begun starting up.
Apr 19 17:37:30 sav-subsystems 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 done.
Apr 19 17:37:30 sav-subsystems systemd[1]: docker.service: Start request repeated too quickly.
Apr 19 17:37:30 sav-subsystems 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 failed.
Apr 19 17:37:30 sav-subsystems systemd[1]: docker.socket: Unit entered failed state.
Apr 19 17:37:30 sav-subsystems systemd[1]: docker.service: Unit entered failed state.
Apr 19 17:37:30 sav-subsystems systemd[1]: docker.service: Failed with result 'exit-code'.

我也下载了一个 debian 包并安装,但也失败了。

答案1

我可以按照此页面步骤进行安装:https://gist.github.com/levsthings/0a49bfe20b25eeadd61ff0e204f50088

sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu zesty stable"

sudo apt-get update
sudo apt-get install docker-ce

答案2

您能否检查 docker -ce 是否已安装且服务正在运行。有时,如果您尝试多次安装,可能会抛出此类错误。如果是这样,请卸载并尝试按照以下步骤进行安装本教程-

本质上你将运行以下命令 -

  1. 首先安装依赖项

     sudo apt install apt-transport-https ca-certificates curl software-properties-common
    
  2. 将官方 Docker 存储库的 GPG 密钥添加到系统:

    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    
  3. 使用以下命令将 sources.list.d 中的 Docker 存储库添加到 APT 源

    sudo add-apt-repository "deb [arch=amd64] 
    https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable edge"
    
  4. 验证你是否能够从 Docker 存储库安装 Docker

    apt-cache policy docker-ce
    
  5. 最后,使用以下命令安装 Docker CE 包

    sudo apt-get install -y docker-ce
    

瞧,你已经安装了 Docker-CE。你可以通过检查安装的 docker-ce 版本来验证安装是否成功

docker --version

相关内容