docker 报错整理

  1. 云栖社区>
  2. 博客>
  3. 正文

docker 报错整理

机智如我丶 2015-12-14 15:38:00 浏览3424
展开阅读全文

一、docker images 上传到 registry 错误

错误信息:
(1)、无法登录到仓库
(2)、ping 尝试失败与错误

[root@docker-100 ~]# docker push 10.1.0.100:5000/registry
The push refers to a repository [10.1.0.100:5000/registry] (len: 1)
unable to ping registry endpoint https://10.1.0.100:5000/v0/
v2 ping attempt failed with error: Get https://10.1.0.100:5000/v2/: EOF
 v1 ping attempt failed with error: Get https://10.1.0.100:5000/v1/_ping: EOF

报错原因:
其实这个问题是因为 docker 启动配置参数里面没有添加安全受信的注册服务器,那我们来修改下配置参数

解决方案:
vim /etc/sysconfig/docker

旧:OPTIONS='--selinux-enabled '   添加参数--secure-registry 来指定自己的 registry 地址
新:OPTIONS='--selinux-enabled --insecure-registry 10.1.0.100:5000'

service docker restart

下面接着 push images 到 registry,成功!

[root@docker-100 ~]# docker push 10.1.0.100:5000/logstash
The push refers to a repository [10.1.0.100:5000/logstash] (len: 1)
Sending image list
Pushing repository 10.1.0.100:5000/logstash (1 tags)
6d1ae97ee388: Image successfully pushed 
8b9a99209d5c: Image successfully pushed 
2e05a52ffd47: Image successfully pushed 
22c00af7c35d: Image successfully pushed 
c05d61710100: Image successfully pushed 
e8b5148980fa: Image successfully pushed 
ed9e0e766fe2: Image successfully pushed 
9a68a1a0c829: Image successfully pushed 
Pushing tag for rev [9a68a1a0c829] on {http://10.1.0.100:5000/v1/repositories/logstash/tags/latest}
[root@docker-100 ~]# 

二、docker 容器中 tomcat 运行报错

错误信息:
(1)、权限拒绝

java.io.FileNotFoundException: /usr/local/tomcats/channelui/logs/host-manager.2015-12-19.log (Permission denied)

错误原因:
当时在做这个东西的时候没有关闭 selinux,所以导致 docker 内部无法操作挂载在宿主机上面的 volume

解决方案:

vim /etc/selinux/config ,disabled
setenforce 0

三、为容器映射端口 iptables 报错

错误信息:
docker0: iptables: No chain/target/match by that name

iptables failed: iptables –wait -t nat -A DOCKER -p tcp -d 0/0 –dport 8443 -j DNAT –to-destination 172.17.0.137:8443 ! -i docker0: iptables: No chain/target/match by that name.

错误原因:
在防火墙中默认 nat 是 REJECT的,所以端口映射

解决方案

vim /etc/sysconfig/iptables
#-A FORWARD -j REJECT --reject-with icmp-host-prohibited

运行容器就 ok
docker run -dit –name channelui -p 8080:8080 -p 8005:8005 -p 8009:8009 -p 8443:8443 -v /data/logs/channelui/:/usr/local/tomcats/channelui/logs -v /etc/localtime:/etc/localtime:ro channelui

网友评论

登录后评论
0/500
评论
机智如我丶
+ 关注