skip to Main Content

I have a problem when i execute the next docker instructions:

# make a directory
mkdir /server/nginx
cd /server/nginx

 # make a container
docker run --name nginx 
-d -p 8080:8080 
-v /home/www:/home/www 
-v /home/www:/usr/share/nginx/html 
-v "$PWD"/nginx.conf:/etc/nginx/nginx.conf 
-v "$PWD"/logs:/var/log/nginx 
-v "$PWD"/conf.d:/etc/nginx/conf.d 
--link php 
-d nginx

I get the next error

docker: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:545: container init caused: rootfs_linux.go:76: mounting "/server/nginx/nginx.conf" to rootfs at "/etc/nginx/nginx.conf" caused: mount through procfd: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type. 

Docker generated the next directories:

drwxr-xr-x 5 root root 4096 Jan 7 05:03 ./
drwxr-xr-x 8 root root 4096 Jan 7 04:49 ../
drwxr-xr-x 2 root root 4096 Jan 7 05:03 conf.d/
drwxr-xr-x 2 root root 4096 Jan 7 05:03 logs/
drwxr-xr-x 2 root root 4096 Jan 7 05:03 nginx.conf/

When need be files not directories.

2

Answers


  1. drwxr-xr-x 2 root root 4096 Jan 7 05:03 nginx.conf/

    The d above means nginx.conf is not a file, but a folder. You could try to cd nginx.conf to verify it.

    As the error indicates, you should setup a nginx.conf file, not a nginx.conf folder.

    Login or Signup to reply.
  2. Happened to me starting a container having previously mounted volume from one location, while I assigned it meanwhile other location. After removing and recreating containers from the start, binding/mounting a new volume path, it worked.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search