# Nginx mounting volumes issue

**URL:** <https://forums.suse.com/t/nginx-mounting-volumes-issue/8052>\
**Category:** Rancher 1.x\
**Created:** [December 14, 2017, 10:30pm UTC](https://forums.suse.com/t/nginx-mounting-volumes-issue/8052 "2017-12-14T22:30:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gonzi76](https://avatars.discourse-cdn.com/v4/letter/g/e79b87/32.png) [@gonzi76](https://forums.suse.com/u/gonzi76)\
**Post date:** [December 14, 2017, 10:30pm UTC](https://forums.suse.com/t/nginx-mounting-volumes-issue/8052/1 "2017-12-14T22:30:54Z")

</div>

This line in docker-compose.yml file:  
volumes:  
- /rancher-nfs/nginx/nginx.conf:/etc/nginx/conf.d/default.conf

cause this issue:  
Activating (Expected state running but got error: Error response from daemon: oci runtime error: container\_linux.go:247: starting container process caused “process\_linux.go:359: container init caused “rootfs\_linux.go:54: mounting \”/rancher-nfs/nginx/nginx.conf\” to rootfs \"/var/lib/docker/overlay/e4cadcb773b96bbf5b0162a247ad4816de5197985693b556cb2db467daad897c/merged\" at \"/var/lib/docker/overlay/e4cadcb773b96bbf5b0162a247ad4816de5197985693b556cb2db467daad897c/merged/etc/nginx/conf.d/default.conf\" caused \“not a directory\”"" : 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)

I do not know why…

---

<div class="post-metadata">

**Author:** ![shubbard343](https://avatars.discourse-cdn.com/v4/letter/s/47e85d/32.png) [@shubbard343](https://forums.suse.com/u/shubbard343)\
**Post date:** [December 19, 2017, 7:47pm UTC](https://forums.suse.com/t/nginx-mounting-volumes-issue/8052/2 "2017-12-19T19:47:26Z")

</div>

Is “/rancher-nfs/nginx/nginx.conf” a local directory on the host?  
By the name, it sounds like you are trying to use rancher-nfs as the source? If so, then you need to have a separate volumes: declaration.

Here’s an example (Rancher 1.6.3)

```
version: '2'
volumes:
  ubuntu-test-volume:
    external: true
    driver: rancher-nfs
services:
  ubuntu:
    image: ubuntu:16.04
    stdin_open: true
    entrypoint:
    - sleep
    - infinity
    volumes:
    - ubuntu-test-volume:/opt/test/volume
    tty: true
    labels:
      io.rancher.container.pull_image: always
```

---

<div class="post-metadata">

**Author:** ![gonzi76](https://avatars.discourse-cdn.com/v4/letter/g/e79b87/32.png) [@gonzi76](https://forums.suse.com/u/gonzi76)\
**Post date:** [December 20, 2017, 1:17am UTC](https://forums.suse.com/t/nginx-mounting-volumes-issue/8052/3 "2017-12-20T01:17:17Z")

</div>

Could you please explain why?

BTW  
Ihave noticed that this line goes without error even if not have “seperate volume declaration”  
/rancher-nfs/nginx/nginx.conf:/etc/nginx/conf.d

Any light in the tunnel? I do not like to do things I do not understand why and what for…

At the same time I had no erorr with volume declaration like

- /rancher-nfs/mariadb\_data:/var/lib/mysql for mysql  
or  
/rancher-nfs/app:/app for php-fpm

---

<div class="post-metadata">

**Author:** ![shubbard343](https://avatars.discourse-cdn.com/v4/letter/s/47e85d/32.png) [@shubbard343](https://forums.suse.com/u/shubbard343)\
**Post date:** [December 20, 2017, 8:00pm UTC](https://forums.suse.com/t/nginx-mounting-volumes-issue/8052/4 "2017-12-20T20:00:58Z")

</div>

Are you, in fact, trying to use rancher-nfs as the source for the volume?

When you specify a volume, you specify a source and a target within the container, separated by a colon. In your config, you are using “/rancher-nfs/nginx/nginx.conf” as the source, so docker is going to look on the host’s local filesystem in that directory. If that directory doesn’t exist on the host, then you would get an error.

If you want to use rancher-nfs, then you need to have the named volume and tell Rancher that the volume needs to use the rancher-nfs driver to access the source.
