Docker入门–安装
Docker安装
第一步: apt 更新
sudo apt-get update
第二步: 安装一些必要的包
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
apt-transport-https : https支持的包
(从其他地方看到)这是一个虚拟的过渡包-https支持已在1.5中转移到apt包中。 可以安全地将其删除。
ca-certificates :认证授权CA证书
该软件包包括CA证书的PEM文件,以允许基于SSL的应用程序检查SSL连接的真实性。
curl:Linux中curl是一个利用URL规则在命令行下工作的文件传输工具,可以说是一款很强大的http命令行工具
gnupg-agent:用于数据加密和数字签名的程序
software-properties-common :管理所使用的软件供应商软件来源
第三步: 添加Docker官方GPG密匙
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
验证是否成功:
@ubuntu:~$ sudo apt-key fingerprint 0EBFCD88
pub rsa4096 2017-02-22 [SCEA]
9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
uid [ unknown] Docker Release (CE deb) <docker@docker.com>
sub rsa4096 2017-02-22 [S]
第四步: 设置稳定的仓库
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
add-apt-repository : 将仓库放到apt中
第五步: 安装 Docker Engine - Community
更新apt后安装docker engine
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
docker-ce : 社区版, 企业版是 docker ee
containerd : 容器运行时的管理器
最后: 测试一下:
@ubuntu:~$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete
Digest: sha256:4fe721ccc2e8dc7362278a29dc660d833570ec2682f4e4194f4ee23e415e1064
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/
参考地址:
1)https://docs.docker.com/install/linux/docker-ce/ubuntu/
2)https://www.runoob.com/docker/ubuntu-docker-install.html