1、第一次拉取镜像遇到的问题(OMG 天塌了)



Unable to find image 'nginx:1.26.2' locally

docker: Error response from daemon: Get "https://registry-1.docker.io/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers).

See 'docker run --help'.

 


解决方法:


#1、配置镜像仓库地址

root@ubuntu-1:~# cat /etc/docker/daemon.json

{

        "registry-mirrors": [

                "https://w14ki3ju.mirror.aliyuncs.com",

                "http://hub-mirror.c.163.com",

                "https://registry.docker-cn.com",

                "https://docker.m.daocloud.io"

        ]

}

 

#2、重新加载配置并重启启动docker

root@ubuntu-1:~# systemctl daemon-reload 

root@ubuntu-1:~# systemctl restart docker.service

完美解决,妈妈再也不用担心我的docker学习




2、 WARNING: bridge-nf-call-iptables is disabled 问题处理

今天在执行docker info的过程中遇到了WARNING: bridge-nf-call-iptables is disabled;WARNING: bridge-nf-call-ip6tables is disabled的问题(wtf 咋这么多问题,确定不是为难我胖虎?)


root@ubuntu:~# docker info

......

 Registry Mirrors:

  https://w14ki3ju.mirror.aliyuncs.com/

  http://hub-mirror.c.163.com/

  https://registry.docker-cn.com/

  https://docker.m.daocloud.io/

 Live Restore Enabled: false

 

WARNING: bridge-nf-call-iptables is disabled

WARNING: bridge-nf-call-ip6tables is disabled

让我们先看看为什么会出现bridge-nf-call-iptables is disabled


这个警告信息通常出现在Linux系统中,特别是当你使用iptables进行网络防火墙管理时。"bridge-nf-call-iptables"是一个系统参数,用于控制是否允许在IPv4数据包通过Linux网桥时,将IPv4数据包传递给iptables规则进行处理。


解决办法:


root@k8s1:~# modprobe br_netfilter

 

root@k8s1:~# cat /etc/sysctl.d/docker.conf 

net.bridge.bridge-nf-call-ip6tables = 1

net.bridge.bridge-nf-call-iptables = 1

 

修改docker镜像源为国内镜像

为了将Docker镜像源修改为国内镜像,你需要更改Docker的配置文件来指定使用的镜像仓库。以下是在不同操作系统上修改Docker镜像源的步骤和示例代码:

对于Linux系统:

  1. 编辑Docker的配置文件daemon.json

sudo nano /etc/docker/daemon.json
  1. 在文件中添加或修改registry-mirrors键值:

{  "registry-mirrors": ["https://registry.docker-cn.com"]}

国内其他常用镜像可能包括:

  • 阿里云:https://<your-id>.mirror.aliyuncs.com

  • 腾讯云:https://mirror.ccs.tencentyun.com


  1. 保存文件并退出编辑器。




  2. 重启Docker服务:



sudo systemctl daemon-reloadsudo systemctl restart docker

对于Windows系统:


  1. 打开Docker Desktop。




  2. 进入Settings(或Preferences)。




  3. 选择"Docker Engine"。




  4. 在"Registry mirrors"部分,添加或修改以下地址:



"registry-mirrors": ["https://registry.docker-cn.com"]
  1. 保存设置并重启Docker。

对于Mac系统:


  1. 打开Docker Desktop。




  2. 点击左上角Docker图标,选择"Preferences"。




  3. 在"Docker Engine"部分,找到"Registry mirrors"。




  4. 添加或修改以下地址:



"registry-mirrors": ["https://registry.docker-cn.com"]
  1. 点击"Apply & Restart"。

完成以上步骤后,Docker将会使用指定的国内镜像仓库来拉取镜像。

提示:AI自动生成,仅供参考


标签: none

添加新评论