ubuntu 18一键安装Docker

Docker Engine – Community 支持上 x86_64(或 amd64)armhf,arm64,s390x (IBM Z),和 ppc64le(IBM的Power)架构。

Docker 安装有一键安装,也有手动安装,手动安装相对来说会复杂一些。国内有一键安装的方式,今天主要讲解一键安装的方法。

卸载旧版本

Docker的旧版本被称为dockerdocker.iodocker-engine。如果安装了这些,请卸载它们:

$ sudo apt-get remove docker docker-engine docker.io containerd runc

如果apt-get报告未安装这些软件包,则可以。

的内容(/var/lib/docker/包括图像,容器,卷和网络)被保留。如果您不需要保存现有数据,并希望从全新安装开始,请参阅 此页面底部的“卸载Docker Engine”部分。

一键安装

可以使用国内 daocloud 一键安装命令:

curl -sSL https://get.daocloud.io/docker | sh

安装的过程中会在一个地方卡主,如下图:

ubuntu安装docker
ubuntu安装docker

什么原因?(新手不知道,后续知道再补充!我猜他是在下载docker安装包)

我的方法是关闭命令控制面板,重新使用命令再试一下,然后再相同的地方又会卡主,不过等一会就安装成功了。

ubuntu安装docker
ubuntu安装docker

以下是命令行:

root@ubuntu:/home/louis# curl -sSL https://get.daocloud.io/docker | sh
# Executing docker install script, commit: 3d8fe77c2c46c5b7571f94b42793905e5b3e42e4
+ sh -c apt-get update -qq >/dev/null
+ sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq apt-transport-https ca-certificates curl >/dev/null
+ sh -c curl -fsSL "https://download.docker.com/linux/ubuntu/gpg" | apt-key add -qq - >/dev/null
Warning: apt-key output should not be parsed (stdout is not a terminal)
+ sh -c echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable" > /etc/apt/sources.list.d/docker.list
+ sh -c apt-get update -qq >/dev/null
+ [ -n  ]
+ sh -c apt-get install -y -qq --no-install-recommends docker-ce >/dev/null
+ sh -c docker version
Client: Docker Engine - Community
 Version:           20.10.5
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        55c4c88
 Built:             Tue Mar  2 20:18:05 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.5
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       363e9a8
  Built:            Tue Mar  2 20:16:00 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.4
  GitCommit:        05f951a3781f4f2c1911b05e61c160e9c30eaa8e
 runc:
  Version:          1.0.0-rc93
  GitCommit:        12644e614e25b05da6fd08a38ffa0cfe1903fdec
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:

  sudo usermod -aG docker your-user

Remember that you will have to log out and back in for this to take effect!

WARNING: Adding a user to the "docker" group will grant the ability to run
         containers which can be used to obtain root privileges on the
         docker host.
         Refer to https://docs.docker.com/engine/security/security/#docker-daemon-attack-surface
         for more information.
root@ubuntu:/home/louis# 

卸载Docker

  1. 卸载Docker Engine,CLI和Containerd软件包:$ sudo apt-get purge docker-ce docker-ce-cli containerd.io
  2. 主机上的映像,容器,卷或自定义配置文件不会自动删除。要删除所有图像,容器和卷:$ sudo rm -rf /var/lib/docker $ sudo rm -rf /var/lib/containerd

您必须手动删除所有已编辑的配置文件。

滚动至顶部
扫码添加微信联系我们 关闭