1、在Docker官网下载安装包:Docker: Accelerated, Containerized Application DevelopmentDocker is a platform designed to help developers build, share, and run modern applications. We handle the tedious setup, so you can focus on the code.https://www.docker.com/2、安装后查看是否安装成功:
docker --version
或
docker version
出现:表示安装成功。
3、运行
docker run hello-world
可能会出现以下错误:
Unable to find image 'hello-world:latest' locally
docker: Error response from daemon: Get https://registry-1.docker.io/v2/: x509: certificate is valid for www.doctorcom.com, not registry-1.docker.io.
See 'docker run --help'.
4、解决办法:
在docker设置中找到Docker Enginer:在Json中加入:
"registry-mirrors": ["https://fop0tofh.mirror.aliyuncs.com"]
5、重启docker
6、如果还不行:则在/etc/host下加入IP地址
查看
dig @114.114.114.114 registry-1.docker.io
命令如下:sudo vim /etc/hosts。
格式如下:
34.205.13.154 registry-1.docker.io
44.205.64.79 registry-1.docker.io
3.216.34.172 registry-1.docker.io
7、同时打开 sudo vim /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
8、然后重启项目。