在运行docker容器docker run -d --name nginx nginx
之后,我不能在此容器上使用“ docker exec” docker exec nginx echo 123
。
我收到一个错误:
ERRO[2018-08-19T11:09:10.909894729+03:00] stream copy error: reading from a closed fifo
ERRO[2018-08-19T11:09:10.909988081+03:00] stream copy error: reading from a closed fifo
ERRO[2018-08-19T11:09:10.931102317+03:00] Error running exec 19c6ae3c5d796180e02577f037f6a1bd1453b70393098643719dea3537933ae2 in container: OCI runtime exec failed: exec failed: container_linux.go:348: starting container process caused "process_linux.go:86: executing setns process caused \"exit status 22\"": unknown`
操作系统:ubuntu 14.04 内核:3.13.0-153通用 Docker:Docker版本18.06.0-ce,内部版本0ffa825
Docker信息:
Containers: 1
Running: 1
Paused: 0
Stopped: 0
Images: 1
Server Version: 18.06.0-ce
Storage Driver: aufs
Root Dir: /var/lib/docker/165536.165536/aufs
Backing Filesystem: extfs
Dirs: 5
Dirperm1 Supported: false
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: d64c661f1d51c48782c9cec8fda7604785f93587
runc version: 69663f0bd4b60df09991c08812a60108003fa340
init version: fec3683
Security Options:
apparmor
userns
Kernel Version: 3.13.0-153-generic
Operating System: Ubuntu 14.04.5 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 3.86GiB
Name: **************
ID: OL25:ISXX:RWR7:EY76:OQ6O:XLWG:ETWJ:FV2A:MC6A:ROP7:6DWD:DJX4
Docker Root Dir: /var/lib/docker/165536.165536
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
谢谢!
答案 0 :(得分:0)
请更新您的内核。尽管Docker应该适用于大多数Kernel 3.10+版本,但是较旧的Kernels常常存在一些底层问题。对于看似可行的解决方案,另请参见https://github.com/moby/moby/issues/36084#issuecomment-364886573:
更新为HWE(4.13.0-32-generic)并再次执行exec,但是请记住,库存16.04使用4.4.0内核-应该(至少)发出某种警告(至少),特定版本组合将不起作用
答案 1 :(得分:0)
当他们使用ENTRYPOINT而不是CMD时,可能会发生这种情况。使用“ docker inspect”检查您的图像/容器。您的命令行参数将成为ENTRYPOINT的CMD。
https://docs.docker.com/engine/reference/builder/#understand-how-cmd-and-entrypoint-interact
答案 2 :(得分:0)
只要执行docker run -it opensuse/leap
后跟exit
命令,我都可以重现此问题。退出命令后,该容器实际上已停止,但仍显示在docker ps
中运行。
解决方案:重新启动docker守护进程。然后尝试再次运行容器。如果停止,则不会显示运行状态。
命令:service docker restart
这对我来说很有效。