yalong@yalong-NUC8i7BEH:~#sudo apt-get remove docker docker-engine docker.io containerd runc
yalong@yalong-NUC8i7BEH:~#sudo apt-get update
yalong@yalong-NUC8i7BEH:~#sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
yalong@yalong-NUC8i7BEH:~#sudo sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
yalong@yalong-NUC8i7BEH:~#sudo apt-get update
yalong@yalong-NUC8i7BEH:~#sudo apt-get install apt-transport-https ca-certificates software-properties-common curl
yalong@yalong-NUC8i7BEH:~#sudo curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
yalong@yalong-NUC8i7BEH:~#sudo add-apt-repository "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
yalong@yalong-NUC8i7BEH:~#sudo apt-get install docker-ce
yalong@yalong-NUC8i7BEH:~#sudo docker run hello-world
#出现下述内容,表示 docker 还没这个镜像,docker 要下载,这里要稍等一会,如果长时间不显示,那么可以多执行几次这个命令
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:
- The Docker client contacted the Docker daemon.
- The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64) - The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading. - 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/
yalong@yalong-NUC8i7BEH:#sudo systemctl status docker#sudo systemctl enable docker
yalong@yalong-NUC8i7BEH:
yalong@yalong-NUC8i7BEH:~#sudo systemctl start docker
参考网站:
欢迎来到这里!
我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。
注册 关于