282 字
1 分钟
docker
自动安装
卸载旧版本
# CentOSyum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-selinux \ docker-engine-selinux \ docker-engine# Debianapt-get remove docker \ docker-engine \ docker.io使用脚本自动安装
curl -fsSL get.docker.com -o get-docker.shsh get-docker.sh --mirror Aliyun# sh get-docker.sh --mirror AzureChinaCloud启动 Docker CE
#设置开机自启动systemctl enable docker
#启动dockersystemctl start docker或service docker start中国源
Docker 很多镜像动不动就 1G 或几百 M,官方经常掉线。所以只能换国内源。
国内的镜像源有
- docker 官方中国区
https://registry.docker-cn.com - 网易
http://hub-mirror.c.163.com - ustc
http://docker.mirrors.ustc.edu.cn - 阿里云
http://<你的 ID>.mirror.aliyuncs.com
注意registry-mirrors千万不要用https,而是用http,否则会显示No certs for egitstry.docker.com, insecure-registries不要任何http头,否则无法通过。
通用的方法就是编辑/etc/docker/daemon.json:
cat > /etc/docker/daemon.json<<-EOF{ registry-mirrors : [ http://ovfftd6p.mirror.aliyuncs.com, http://registry.docker-cn.com, http://docker.mirrors.ustc.edu.cn, http://hub-mirror.c.163.com ], insecure-registries : [ registry.docker-cn.com, docker.mirrors.ustc.edu.cn ], debug : true, experimental : true}EOF然后重启 docker 的 daemon 即可。
systemctl restart dockergraphdriver
failed to start daemon: error initializing graphdriver: prior storage driver devicemapper is deprecated and will be removed in a future release; update the the daemon configuration and explicitly
修复方法: nano /etc/docker/daemon.json
{ storage-driver: devicemapper }保存- 重新启动 Docker.
一键添加:
cat > /etc/docker/daemon.json<<-EOF{ storage-driver: devicemapper }EOFsystemctl restart docker