Docker 问题记录

Docker问题记录

问题一:启动不了Docker

问题:

shell 复制代码
[root@iZ2zeg7mctvft5renx1qvbZ docker]# systemctl start docker
Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xe" for details.

解决方案

  1. 修改配置文件的后缀名
  2. 重点:将linux服务器重启
shell 复制代码
[root@iZ2zeg7mctvft5renx1qvbZ docker]# pwd
/etc/docker
[root@iZ2zeg7mctvft5renx1qvbZ docker]# mv daemon.json daemon.conf

问题二:启动不了容器

问题:重启&启动了防火墙

shell 复制代码
[root@iZ2zeg7mctvft5renx1qvbZ home]# docker run -d -p 8081:8080 tomcat
4aac3e910d8a6d20523654a08ae4d8b18734454d41a863ade0fe2e901dec711d
docker: Error response from daemon: driver failed programming external connectivity on endpoint suspicious_shtern (895d3e89b519723e65e40144422d57e9452be03794a852230594de16f7f26271):  (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 8081 -j DNAT --to-destination 172.17.0.4:8080 ! -i docker0: iptables: No chain/target/match by that name.
 (exit status 1)).

解决方案

​ 当 firewalld 启动或者重启的时候,将会从 iptables 中移除 DOCKER 的规则,从而影响了 Docker 的正常工作。

​ 当你使用的是 Systemd 的时候, firewalld 会在 Docker 之前启动,但是如果你在 Docker 启动之后操作 firewalld ,你就需要重启 Docker 进程了。

​ 解决办法:输入指令 如下指令,重启docker服务及可重新生成自定义链docker

shell 复制代码
systemctl restart docker
相关推荐
lichenyang4532 天前
Docker 学习笔记(五):Docker Compose,用一个 YAML 启动前端、后端和 MongoDB
docker
lichenyang4532 天前
Docker 学习笔记(四):Dockerfile,把项目打成自己的镜像
docker·容器
lichenyang4532 天前
Docker 学习笔记(三):Docker 网络、bridge、子网和容器互通
docker·容器
lichenyang4532 天前
Docker 学习笔记(二):docker run 的参数到底在控制什么?
docker·容器
Patrick_Wilson6 天前
从「改个端口」到 502:Next.js on k8s 的容器端口、Service 映射与 env 覆盖
docker·kubernetes·next.js
Suroy7 天前
DockerView-Go:用 Go 写一个终端 Docker 监控工具,顺便做了个 Web 仪表盘
docker
云恒要逆袭7 天前
运行你的第一个Docker容器
后端·docker·容器
宋均浩8 天前
# Docker 镜像瘦身实战:从 1.2G 到 80MB 的五个优化步骤
ci/cd·docker
程序员老赵8 天前
10 分钟部署 OpenCode:Docker 一键安装,浏览器打开就能用 AI 写代码(附完整命令与排错)
docker·容器·ai编程
WangMingHua1119 天前
LM Studio Docker 部署——本地大模型一键启动
docker