Docker配置国内镜像源

添加Docker国内镜像源

/etc/docker/daemon.json文件中添加以下内容:

shell 复制代码
{
    "registry-mirrors": [
        "http://hub-mirror.c.163.com",
        "https://docker.mirrors.ustc.edu.cn",
        "https://registry.docker-cn.com"
    ]
}

重启docker

bash 复制代码
sudo systemctl daemon-reload
sudo systemctl restart docker

查看是否配置成功

docker info

重启容器

重启后容器会退出,需要重新启动,启动所有退出容器的命令:

shell 复制代码
docker start $(docker ps -a -q --filter "status=exited")

如果在启动容器时添加了自动重启参数,则在重启docker后,容器会自动重启

shell 复制代码
docker run -d --restart=always [image-name]

如果容器启动时没有设置--restart参数,则可以通过下面命令进行更新:

shell 复制代码
docker update --restart=unless-stopped [container-name]
相关推荐
李狗蛋儿啊1 小时前
zero自动化框架搭建---Git安装详解
运维·git·自动化
小金的学习笔记2 小时前
如何在本地和服务器新建mysql用户和密码
运维·服务器·mysql
s_fox_2 小时前
nginx ngx_http_module(7) 指令详解
运维·nginx·http
EasyNVR2 小时前
EasyRTC智能硬件:实时畅联、沉浸互动、消音护航
运维·服务器·网络·安全·音视频·webrtc·p2p
CarryBest2 小时前
Jenkins 环境搭建---基于 Docker
运维·jenkins
若云止水3 小时前
Ubuntu 下 nginx-1.24.0 源码分析 - ngx_process_options
运维·nginx
s_fox_3 小时前
nginx ngx_http_module(9) 指令详解
运维·nginx·http
_院长大人_4 小时前
Docker Mysql 数据迁移
mysql·adb·docker
xing.yu.CTF5 小时前
Web入侵实战分析-常见web攻击类应急处置实验2
运维·服务器·windows·web安全·apache·php漏洞·phpstudy后门漏洞
我们的五年5 小时前
【Linux网络】TCP/IP地址的有机结合(有能力VS100%???),IP地址的介绍
linux·运维·网络·tcp/ip