Docker安装
-
修改数据源
-
安装Docker CE
sudo apt-get update
sudo apt-get install docker-ce
// 卸载旧版 apt-get remove docker/docker-ce
// 如果安装出问题,则选择直接下载 apt-get install docker -
使用脚本安装[菜鸟:https://www.runoob.com/docker/ubuntu-docker-install.html]
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
// 下载docker得shell脚本 -
Docker加速器
/etc/docker/daemon.json中写入(如果文件不存在则创建)
{"registry-mirrors":["https://registry.docker-cn.com"]}
或者
- 其他加速器
1.网易
http://hub-mirror.c.163.com
2.Docker中国区官方镜像
https://registry.docker-cn.com
3.中国科技大学
https://docker.mirrors.ustc.edu.cn
4.阿里云容器 服务
https://cr.console.aliyun.com/
【整合
{"registry-mirrors":["http://hub-mirror.c.163.com","http://hub-mirror.c.163.com","https://registry.docker-cn.com","https://docker.mirrors.ustc.edu.cn","https://cr.console.aliyun.com/"]}
】
-
重启服务
sudo systemctl daemon-reload
sudo systemctl restart docker -
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
如果报错,输入一下命令:
service docker restart -
在/etc/docker目录下
docker run -p 8080:8080 tomcat
如果没找到镜像,该命令输入完毕,会自动报错找不到该镜像,并从服务器下载,然后启动tomcat,完成该操作;
然后在浏览器输入 ip:8080 ip为Docker所在服务器的地址,如我的在VMware上运行的Centos7的ip地址196.168.。。
如果安装docker,使用docker version发现只有client客户端则有可能是原来配的加速器文件不正确,又没删得掉导致,重新配置;
-
cd /etc/docker
-
vim daemon.json
{
"registry-mirrors": ["https://registry.docker-cn.com"]
}
- systemctl restart docker.service
如果要docker卸载干净则:
-
查询docker相关软件包:
dpkg -l |grep docker -
删除每一个包
sudo apt remove --purge docker-ce-lic...