2. 安装Docker(x86 PC)¶
2.1. 手动安装¶
直接参考Docker官方的安装说明文档,该文档包含了三种安装方式:
https://docs.docker.com/engine/install/debian/#install-using-the-convenience-script
建议直接用最后一种脚本安装的方法,且脚本运行时使用 Aliyun
参数可以通过阿里云镜像加速安装:
# 在PC上执行如下命令,需要联网,耐心等待
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh --mirror Aliyun
2.2. 测试¶
安装完成后,即可运行docker官方的hello-world示例:
# 在PC上执行如下命令
sudo docker run hello-world
以下为docker的hello-world输出:
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.
(x86-64)
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/
2.3. 镜像加速¶
在后面使用Docker应用的时候,经常需要从Dockerhub网站下载大量的资源,但Dockerhub在国内的访问速度不快, 可参考如下网页说明设置国内镜像源进行加速:《Dockerhub镜像加速器》 。