我想在Ubuntu 16.04 LTS上构建和运行Docker容器。我该如何安装Docker?
$ sudo apt-get install docker.io
Ubuntu安装说明详细列出了您需要的一切,但在大多数情况下,它可以归结为:
(1) 设置docker仓库
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 add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
(2)安装Docker CE
sudo apt-get update
sudo apt-get install docker-ce
sudo docker run hello-world
docker.io
软件包版本是docker 18.06.1
。Ubuntu的docker.io
软件包在2018年9月27日进行了更新,这只是在该版本于2018年8月21日发布后一个月。您可能还需要执行安装后的步骤:https://docs.docker.com/install/linux/linux-postinstall/。 - wisbuckydocker
、docker-ce
、docker-engine
,当然还有 docker.io
... - twall$ curl -fsSL https://get.docker.com | sh
wget -qO- https://get.docker.com/ | sh
$ curl -fsSL https://test.docker.com | sh
或者
wget -qO- https://test.docker.com/ | sh
$ curl -fsSL https://experimental.docker.com | sh
或者
wget -qO- https://experimental.docker.com/ | sh
sudo vi /etc/apt/sources.list.d/additional-repositories.list
2. 根据底层Ubuntu版本进行更改:sarah
或其他名称更改为xenial
。tara
或其他名称更改为bionic
。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 $(lsb_release -cs) stable"
sudo apt-get update
apt-cache policy docker-ce
sudo apt-get install -y docker-ce
sudo systemctl status docker
Debian安装。
lsb_release -a | grep Code
代号:xenial
lscpu | grep Arch
架构:x86_64
最后下载你的Debian源码。 前往https://download.docker.com/linux/ubuntu/dists/,选择你的Ubuntu版本,浏览到pool/stable/并选择amd64、armhf、ppc64el或s390x。下载你想要安装的Docker版本的.deb文件。
sudo dpkg -i /path/to/package.deb
docker -v
首先安装依赖项:
sudo apt install apt-transport-https ca-certificates curl software-properties-common
将官方 Docker 存储库的 GPG 密钥添加到系统中:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
使用以下命令将 Docker 存储库添加到 APT 源的 sources.list.d 中:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable edge"
验证是否能够从 Docker 存储库安装 Docker:
apt-cache policy docker-ce
最后,使用以下命令安装 Docker CE 包:
sudo apt-get install -y docker-ce
docker --version
要获取更详细的说明,请点击此教程。