[英]Docker hello-world gives error that container /hello: no such file or directory": unknown
I am new on Docker and try to understand how it works.我是 Docker 的新手,并试图了解它是如何工作的。 I installed docker to virtualbox centos 7 instance.我将 docker 安装到了 virtualbox centos 7 实例。 The service is working properly but when I run hello-world image it gives following error .该服务工作正常,但是当我运行 hello-world 图像时,它给出了以下错误。
[root@localhost ~]# docker run hello-world
docker: Error response from daemon: OCI runtime create failed:
container_linux.go:344: starting container process caused "exec: \"/hello\":
stat /hello: no such file or directory": unknown.
I tried $ docker system prune but didn't work again.我尝试了 $ docker system prune 但没有再次工作。 Here is all command line history that includes system information and docker information.这是包括系统信息和 docker 信息的所有命令行历史记录。
[root@localhost ~]# cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
[root@localhost ~]# docker --version
Docker version 18.09.3, build 774a1f4
[root@localhost ~]# docker run hello-world
docker: Error response from daemon: OCI runtime create failed: container_linux.go:344: starting container process caused "exec: \"/hello\": stat /hello: no such file or directory": unknown.
[root@localhost ~]# docker system prune
WARNING! This will remove:
- all stopped containers
- all networks not used by at least one container
- all dangling images
- all dangling build cache
Are you sure you want to continue? [y/N] y
Deleted Containers:
ace04702bb0e2a1997dc35a0a21c7ca49a395809e5d1da98ddc99ee16544dcc4
e70f5999470577d0eca655643b7ba2ce41ee99495bb257d8ca5f956c26a7079b
82f65c36f76cf2cbf6297a514865d45524bf3cb4472be5e5da72c632cd535a3b
Total reclaimed space: 0B
[root@localhost ~]# docker run hello-world
docker: Error response from daemon: OCI runtime create failed: container_linux.go:344: starting container process caused "exec: \"/hello\": stat /hello: no such file or directory": unknown.
[root@localhost ~]# docker info
Containers: 1
Running: 0
Paused: 0
Stopped: 1
Images: 1
Server Version: 18.09.3
Storage Driver: overlay2
Backing Filesystem: xfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: e6b3f5632f50dbc4e9cb6288d911bf4f5e95b18e
runc version: 6635b4f0c6af3810594d2770f662f34ddc15b40d
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-957.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 3.701GiB
Name: localhost.localdomain
ID: R2XU:6ZAF:2UZO:QBUR:GGWW:GFIG:DHVF:5DZG:DPG2:GIKV:3GE5:NLS2
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
Product License: Community Engine
this is causing because of old version of CentOS.这是由于旧版本的 CentOS 造成的。 Check https://github.com/moby/moby/issues/35906 Please upgrade your CentOS to 7.4.检查https://github.com/moby/moby/issues/35906请将您的 CentOS 升级到 7.4。
After reading some documentation acknowledged that this issue has not occurred from docker but selinux configuration.在阅读了一些文档后承认这个问题不是来自 docker 而是来自selinux配置。 It recommended that #sestatus Current Mode should be permissive but it was enforcing in my case.它建议#sestatus Current Mode应该是宽松的,但在我的情况下它正在执行。 I think this makes all error halts process rather than logging.我认为这会使所有错误停止进程而不是记录。 So所以
#setenforce 0
#docker system prune -a
it works!有用!
Thanks for all help on this issue.感谢您对这个问题的所有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.