赞
踩
Docker 支持以下版本的 Ubuntu 操作系统:
Focal 20.04 (LTS)
Bionic 18.04 (LTS)
Xenial 16.04 (LTS)
sudo apt-get remove docker \
docker-engine \
docker.io
Docker
称为 docker
或者 docker-engine
;Ubuntu
是新装的,目前未安装docker
,可以从卸载命令可以看出来:HTTPS
以确保软件下载过程中不被篡改:sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
# 以后文章建议使用国内源
$ curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
# 官方源
# $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add
-
sources.list
中添加 Docker
软件源:$ sudo add-apt-repository \
"deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu \
$(lsb_release -cs) \
stable"
# 官方源
# $ sudo add-apt-repository \
# "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
# $(lsb_release -cs) \
# stable"
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
$ curl -fsSL get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh --mirror Aliyun
$ sudo systemctl enable docker
$ sudo systemctl start docker
docker
的用户加入 docker
用户组;$ sudo groupadd docker
docker
组:$ sudo usermod -aG docker $USER
cat /etc/group
可以查看加入的用户组;$ docker run hello-world
noamanelson@noamanelson-Virtual-Machine:~$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete
Digest: sha256:4e83453afed1b4fa1a3500525091dbfca6ce1e66903fd4c01ff015dbcb1ba33e
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。