Docker Community Forums

Share and learn in the Docker community.

/usr/bin/docker-current: Error response from daemon: oci runtime error: container_linux.go:235: starting container process caused "container init exited prematurely"

docker run --name my-custom-nginx-container -v /host/path/nginx.conf:/etc/nginx/nginx.conf:ro -d nginx

the cmd error?

[root@centos7 /]# docker run --name my-sdaer -v /myconf/nginx:/etc/nginx/nginx.conf:ro -p 878:80 -d docker.io/nginx
5a2e6c7ddc9af64e81a795333c671b19288ac0d0e8b0a44d1e152e9d3e9f6b77
/usr/bin/docker-current: Error response from daemon: oci runtime error: container_linux.go:235: starting container process caused "container init exited prematurely".

Stupid question, but is “/myconf/nginx” a file ?

Otherwise what does the following command says :

docker logs 5a2e6c7ddc9af64e81a795333c671b19288ac0d0e8b0a44d1e152e9d3e9f6b77

I have known
-v is
-v / absolute path directory of the host : directory in the container
so,i want to add -v
then start nginx container but it is exited,why?

In addition, I saw the log information, but I don’t know how to deal with it and What is the cause of the error!

[root@centos7 /]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
docker.io/tomcat    latest              6fa48e047721        10 days ago         507 MB
docker.io/nginx     latest              231d40e811cd        4 weeks ago         126 MB
[root@centos7 /]# docker  run -p 9500:80 -v /home/lms/config/nginx:/etc/nginx --name nginx1 -d  docker.io/nginx
f96a50196f341d77a7f3f64fbec6886c4954585914edbf3c779c40e7bdc5e560
[root@centos7 /]# docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                     PORTS                    NAMES
f96a50196f34        docker.io/nginx     "nginx -g 'daemon ..."   5 seconds ago       Exited (1) 4 seconds ago                            nginx1
958f3e0c4cc3        docker.io/tomcat    "catalina.sh run"        15 hours ago        Up 41 minutes              0.0.0.0:8882->8080/tcp   tomcat2
670d7d8f1962        docker.io/tomcat    "catalina.sh run"        15 hours ago        Up 41 minutes              0.0.0.0:8881->8080/tcp   tomcat1
[root@centos7 /]# docker start nginx1 
nginx1
[root@centos7 /]# docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                    PORTS                    NAMES
f96a50196f34        docker.io/nginx     "nginx -g 'daemon ..."   13 seconds ago      Exited (1) 1 second ago                            nginx1
958f3e0c4cc3        docker.io/tomcat    "catalina.sh run"        15 hours ago        Up 41 minutes             0.0.0.0:8882->8080/tcp   tomcat2
670d7d8f1962        docker.io/tomcat    "catalina.sh run"        15 hours ago        Up 41 minutes             0.0.0.0:8881->8080/tcp   tomcat1
[root@centos7 /]# docker  run -p 9600:80  --name nginx2 -d  docker.io/nginx
059d8065189bc22da87d3f19b310692870976fd0b15a14362d66d872313bfa18
[root@centos7 /]# docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                      PORTS                    NAMES
059d8065189b        docker.io/nginx     "nginx -g 'daemon ..."   4 seconds ago       Up 3 seconds                0.0.0.0:9600->80/tcp     nginx2
f96a50196f34        docker.io/nginx     "nginx -g 'daemon ..."   47 seconds ago      Exited (1) 35 seconds ago                            nginx1
958f3e0c4cc3        docker.io/tomcat    "catalina.sh run"        15 hours ago        Up 42 minutes               0.0.0.0:8882->8080/tcp   tomcat2
670d7d8f1962        docker.io/tomcat    "catalina.sh run"        15 hours ago        Up 42 minutes               0.0.0.0:8881->8080/tcp   tomcat1
[root@centos7 /]# docker run --name nginx3 -v /host/path/nginx.conf:/etc/nginx/nginx.conf:ro -d docker.io/nginx
9d0d905eaaf4ad686eb6a97950a7000a0661c43ce0ae0f3a2ad067b3a1034204
/usr/bin/docker-current: Error response from daemon: oci runtime error: container_linux.go:235: starting container process caused "container init exited prematurely".
[root@centos7 /]# docker logs nginx3
container_linux.go:235: starting container process caused "container init exited prematurely"
[root@centos7 /]# docker run --name nginx4 -p 9876:80 -v /host/path/nginx.conf:/etc/nginx/nginx.conf:ro -d docker.io/nginx
794f14686db48f2cf6c8cbc235897d0f61178338b085d44bd71b69c9ddf11e47
/usr/bin/docker-current: Error response from daemon: oci runtime error: container_linux.go:235: starting container process caused "container init exited prematurely".
[root@centos7 /]# docker logs nginx4
container_linux.go:235: starting container process caused "container init exited prematurely"
[root@centos7 /]# docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS                     PORTS                    NAMES
794f14686db4        docker.io/nginx     "nginx -g 'daemon ..."   About a minute ago   Created                                             nginx4
9d0d905eaaf4        docker.io/nginx     "nginx -g 'daemon ..."   About a minute ago   Created                                             nginx3
059d8065189b        docker.io/nginx     "nginx -g 'daemon ..."   2 minutes ago        Up 2 minutes               0.0.0.0:9600->80/tcp     nginx2
f96a50196f34        docker.io/nginx     "nginx -g 'daemon ..."   3 minutes ago        Exited (1) 3 minutes ago                            nginx1
958f3e0c4cc3        docker.io/tomcat    "catalina.sh run"        15 hours ago         Up 44 minutes              0.0.0.0:8882->8080/tcp   tomcat2
670d7d8f1962        docker.io/tomcat    "catalina.sh run"        15 hours ago         Up 44 minutes              0.0.0.0:8881->8080/tcp   tomcat1
[root@centos7 /]# ^C
[root@centos7 /]# 

for this issue try to check volume mount point permissions it should not be other ownership lik ROOT, so the user from which you are starting the container should own the volume mounts