Docker常见错误

一、存储驱动错误

问题:

[root@xiaoqiang docker]# docker run hello-world
docker: Error response from daemon: error creating aufs mount to /var/lib/docker/aufs/mnt/9f1cc4ec95241a1432a23f4ee7a1eb1c3fcf239ad203f915668967685ded08c4-init: invalid argument.
See 'docker run --help'.

解决:

# 修改存储类型
vim /etc/docker/daemon.json
{
  "storage-driver": "vfs",
  "registry-mirrors": ["https://v8o5rqy6.mirror.aliyuncs.com"]
}
# 重启docker服务
systemctl daemon-reload && systemctl restart docker
# 查看docker信息
[root@xiaoqiang docker]# docker info
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 0
Server Version: 18.06.1-ce
# aufs修改成vfs
Storage Driver: vfs
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 468a545b9edcd5932818eb9de8e72413e616e86e
runc version: 69663f0bd4b60df09991c08812a60108003fa340
init version: fec3683
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.15.0-111-generic
Operating System: CentOS Linux 7 (Core) (containerized)
OSType: linux
Architecture: x86_64
CPUs: 16
Total Memory: 1GiB
Name: xiaoqiang
ID: RWVR:PMVN:RXON:OQ5H:RNFU:MNWE:JVVZ:D76W:MIYT:YL2L:DPEI:LC7V
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

WARNING: No swap limit support
# 运行成功
[root@xiaoqiang docker]# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
0e03bdcc26d7: Pull complete 
Digest: sha256:4cf9c47f86df71d48364001ede3a4fcd85ae80ce02ebad74156906caff5378bc
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/
# 存储类型有
|Storage driver |Must match backing filesystem |
|---------------|------------------------------|
|overlay        |No                            |
|aufs           |No                            |
|btrfs          |Yes                           |
|devicemapper   |No                            |
|vfs            |No                            |
|zfs            |Yes                           |

二、启动权限不够

问题:

operation not permitted
[root@xiaoqiang nacos]# ls
data  docker-compose.yaml
[root@xiaoqiang nacos]# docker-compose up
Starting nacos ... error

ERROR: for nacos  Cannot start service nacos: OCI runtime create failed: container_linux.go:348: starting container process caused "operation not permitted": unknown

ERROR: for nacos  Cannot start service nacos: OCI runtime create failed: container_linux.go:348: starting container process caused "operation not permitted": unknown
ERROR: Encountered errors while bringing up the project.

解决:

去掉privileged或者加上privileged

三、服务启动超时

问题:

root@xiaoqiangzai:/home/qiang/docker-compose/nacos[root@xiaoqiangzai nacos]# docker-compose up -d && docker logs -f nacos
Creating network "nacos_default" with the default driver
Creating nacos ... 

ERROR: for nacos  UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=60)

ERROR: for nacos  UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=60)
ERROR: An HTTP request took too long to complete. Retry with --verbose to obtain debug information.
If you encounter this issue regularly because of slow network conditions, consider setting COMPOSE_HTTP_TIMEOUT to a higher value (current value: 60).

解决:

vim /etc/profile
export COMPOSE_HTTP_TIMEOUT=500
export DOCKER_CLIENT_TIMEOUT=500
source /etc/profile

四、登录界面重叠

问题:

引起这个问题的原因是在使用"docker run"运行容器时使用了 “/sbin/init"和”–privileged"参数。使用/sbin/init启动容器并加上–privileged参数,相当于docker容器获得了宿主机的全权委托权限。这时docker容器内部的init与宿主机的init产生了混淆。

解决:

systemctl status getty@tty1.service
systemctl stop getty@tty1.service
systemctl disable getty@tty1.service

作者(Author):小强崽
来源(Source):https://www.wuduoqiang.com/archives/Docker常见错误
协议(License):署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)
版权(Copyright):商业转载请联系作者获得授权,非商业转载请注明出处。 For commercial use, please contact the author for authorization. For non-commercial use, please indicate the source.

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值