- 启动Docker容器时遇到错误
- 标签:
docker, docker run, docker start,
- 环境:
Docker version 1.12.6, build 1398f24/1.12.6
[[email protected] jenkins]# cat /proc/version
Linux version 3.10.0-514.el7.x86_64 ([email protected]) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC) ) #1 SMP Tue Nov 22 16:42:41 UTC 2016
[[email protected] jenkins]# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
[[email protected] jenkins]#
我在Share PC上运行Docker, Share PC不能上外网
- 问题描述:
[[email protected] ~]# docker run centos /bin/echo ‘Hello World‘
container_linux.go:247: starting container process caused "process_linux.go:334: running prestart hook 1 caused \"error running hook: exit status 1, stdout: , stderr: \""
/usr/bin/docker-current: Error response from daemon: invalid header field value "oci runtime error: container_linux.go:247: starting container process caused \"process_linux.go:334: running prestart hook 1 caused \\\"error running hook: exit status 1, stdout: , stderr: \\\"\"\n".
- 问题分析:
该问题是由于设置了Docker代理引起的.
设置Docker代理如下:
# following link is to resolve docker-runc not found issue,proxy is not necessary *#
ln -s /usr/libexec/docker/docker-proxy-current /usr/bin/docker-proxy
ln -s /usr/libexec/docker/docker-runc-current /usr/bin/docker-runc
# 设置代理
sudo HTTP_PROXY=http://135.251.33.16:80 /usr/bin/dockerd --userland-proxy=false &
- 解决方案:
我尝试了Disable SELinux
修改配置文件需要重启机器:
修改/etc/selinux/config 文件
将SELINUX=enforcing改为SELINUX=disabled
不成功.
然后我试图停止由代理启动(sudo HTTP_PROXY命令)的docker服务: service docker stop
显示停止成功,但是实际没有成功.
最后我重启Share PC.
重启后,启动Docker: service docker start.
就可以正确运行docker了:
[r[email protected] ~]# docker run centos /bin/echo ‘Hello World‘
Hello World
[[email protected] ~]#
其他:
我现在担心是不是在创建Dockerfile并build时,是否需要