Docker使用中遇到的一些问题
2018-12-24 23:47
1166 查看
常见报错
error1
push镜像到本地仓库时报错 Error: Invalid registry endpoint https://10.10.3.67:5000/v2/: Get https://10.10.3.67:5000/v2/_ping: dial tcp 10.10.3.67:5000: connection refused. If this private registry supports only 5b4 HTTP or HTTPS with an unknown CA certificate, please add `--insecure-registry 10.10.3.67:5000` to the daemon's arguments. In the case of HTTPS, if you have access to the registry's CA certificate, no need for the flag; simply place the CA certificate at /etc/docker/certs.d/10.10.3.67:5000/ca.crt 或者 http: server gave HTTP response to HTTPS client 因为Docker从1.3.X之后,与docker registry交互默认使用的是https,然而此处搭建的私有仓库只提供http服务,所以当与私有仓库交互时就会报上面的错误。为了解决这个问题需要在启动docker server时增加启动参数为默认使用http访问。centos7下修改docker启动配置文件 [root@docker shell]# cat /usr/lib/systemd/system/docker.service [Unit] Description=Docker Application Container Engine Documentation=https://docs.docker.com After=network-online.target firewalld.service Wants=network-online.target [Service] Type=notify ExecStart=/usr/bin/dockerd --insecure-registry 10.10.3.67:5000 再修改 [root@docker shell]# cat /etc/docker/daemon.json { "registry-mirrors": [ "https://registry.docker-cn.com" ] } { "insecure-registry":["10.10.3.67:5000"] } 然后重启服务 systemctl daemon-reload systemctl restart docker
error2
[root@docker shell]# docker-compose up -d /etc/docker/registry/docker-compose.yml ERROR: Can't find a suitable configuration file in this directory or any 5b4 parent. Are you in the right directory? Supported filenames: docker-compose.yml, docker-compose.yaml 切换到docker-compose.yaml所在目录下 启动成功
error3
ERROE:Cannot locate specified Dockerfile: Dockerfile 需要在docker-compose.yml里面指定Dockerfile路径 [root@docker data]# tree compose-test/ compose-test/ ├── docker │ ├── docker-compose.yml │ ├── requirement.txt │ └── web │ └── Dockerfile └── src └── app.py 在docker-compose.yml文件添加如下字段 app: build: context: web dockerfile: Dockerfile
###error4
Docker默认的配置文件/etc/default/docker或者/etc/sysconfig/docker都不起作用,查看了一下/lib/systemd/system/docker.service文件,发现里面没有加载默认配置文件,一些配置不知道要怎么弄了~~~ 解决办法是: $ vi /lib/systemd/system/docker.service #添加一行 $ EnvironmentFile=-/etc/default/docker 或者 $ EnvironmentFile=-/etc/sysconfig/docker #-代表ignore error #并修改 $ ExecStart=/usr/bin/docker daemon -H fd:// #改成 $ ExecStart=/usr/bin/docker daemon -H fd:// $DOCKER_OPTS 这样才能使用/etc/default/docker里定义的DOCKER_OPTS参数 $ systemctl daemon-reload 重载 $ sudo service docker restart
###启动报错
[root@docker data]# systemctl status docker -l 5af ● docker.service - Docker Application Container Engine Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Tue 2018-08-14 18:05:23 CST; 4min 31s ago Docs: https://docs.docker.com Process: 5580 ExecStart=/usr/bin/dockerd (code=exited, status=1/FAILURE) Main PID: 5580 (code=exited, status=1/FAILURE) Aug 14 18:05:22 docker systemd[1]: Starting Docker Application Container Engine... Aug 14 18:05:22 docker dockerd[5580]: time="2018-08-14T18:05:22.617552865+08:00" level=info msg="libcontainerd: new containerd process, pid: 5586" Aug 14 18:05:23 docker dockerd[5580]: time="2018-08-14T18:05:23.623094222+08:00" level=error msg="[graphdriver] prior storage driver overlay2 failed: driver not supported" Aug 14 18:05:23 docker dockerd[5580]: Error starting daemon: error initializing graphdriver: driver not supported Aug 14 18:05:23 docker systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE Aug 14 18:05:23 docker systemd[1]: Failed to start Docker Application Container Engine. Aug 14 18:05:23 docker systemd[1]: Unit docker.service entered failed state. Aug 14 18:05:23 docker systemd[1]: docker.service failed. Warning: docker.service changed on disk. Run 'systemctl daemon-reload' to reload units. root@docker data]# cat /etc/systemd/system/multi-user.target.wants/docker.service [Unit] Description=Dock b65 er Application Container Engine Documentation=https://docs.docker.com After=network.target firewalld.service [Service] Type=notify # the default is not to use systemd for cgroups because the delegate issues still # exists and systemd currently does not support the cgroup feature set required # for containers run by docker ExecStart=/usr/bin/dockerd --storage-driver=overlay2 --storage-opt overlay2.override_kernel_check=1 #更改此处,版本检查导致报错 ExecReload=/bin/kill -s HUP $MAINPID # Having non-zero Limit*s causes performance problems due to accounting overhead # in the kernel. We recommend using cgroups to do container-local accounting. LimitNOFILE=infinity LimitNPROC=infinity LimitCORE=infinity # Uncomment TasksMax if your systemd version supports it. # Only systemd 226 and above support this version. #TasksMax=infinity TimeoutStartSec=0 # set delegate yes so that systemd does not reset the cgroups of docker containers Delegate=yes # kill only the docker process, not all processes in the cgroup KillMode=process [Install] WantedBy=multi-user.target
另一种启动报错
Aug 15 16:58:15 SoYi-Matchengine dockerd[23840]: time="2018-08-15T16:58:15.174852047+08:00" level=error msg="[graphdriver] prior storage driver overlay2 failed: driver not supported" Aug 15 16:58:15 SoYi-Matchengine dockerd[23840]: Error starting daemon: error initializing graphdriver: driver not supported Aug 15 16:58:15 SoYi-Matchengine systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
应该是旧版本docker的仓库目录冲突导致
mv /var/lib/docker /var/lib/docker.old 然后启动docker
相关文章推荐
- 使用docker selenium 构建web自动化分布式测试环境时,遇到的一些问题
- nova-docker安装使用中遇到的一些问题(juno版)
- maven使用中遇到的一些问题总结
- .net在使用Lucene中遇到的一些问题总结
- 关于switchport Port-security 使用遇到的一些问题
- 使用存储过程遇到的一些问题
- 近期使用缓存中遇到的一些问题小结
- 我在Eclipse中使用Tomcat插件的遇到的一些问题
- Qt开发环境中使用报表控件FastReport遇到的一些问题(一)
- 使用desinger时遇到的一些问题的处理分享
- Struts2.1.8 验证框架(validation)的使用中遇到的一些问题(直接访问jsp遇到的错误)
- Qt 笔记(记录使用Qt中遇到的一些问题)
- Myeclipse 2013 初步使用遇到的一些问题
- 使用Code Blocks编写C++程序遇到的一些问题
- repo使用过程中遇到的一些问题及解决办法
- 使用win8.1遇到的一些问题
- 【汇总】iOS开发及Xcode使用中遇到的一些报错问题汇总
- 使用Linq 更新数据库时遇到的一些问题及解决办法
- [项目过程中所遇到的各种问题记录]ORM篇——使用NHibernate配置对象实体的一些小问题
- 今天使用eclipse-hilos版本的开发项目遇到一些问题