After running docker compose up, volumes are not visible.
I'm logging with docker run -it CONTAINERNAME bash but the files are not there
Output of "docker-compose version"
docker-compose verions 1.22.0, build f46880fe
docker-py version: 3.4.1
CPython version: 3.6.6
OpenSSL version: OpenSSL 1.1.0f 25 May 2017
Output of "docker version"
docker version
Client:
Version: 18.06.1-ce
API version: 1.38
Go version: go1.10.3
Git commit: e68fc7a
Built: Tue Aug 21 17:25:03 2018
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: 18.06.1-ce
API version: 1.38 (minimum version 1.12)
Go version: go1.10.3
Git commit: e68fc7a
Built: Tue Aug 21 17:23:27 2018
OS/Arch: linux/amd64
Experimental: false
Output of "docker-compose config"
services:
myapp-elasticsearch:
image: elasticsearch:5.6.8
ports:
- 10005:9200/tcp
myapp-jenkins:
image: jenkins/jenkins:lts
ports:
- 10007:8080/tcp
myapp-php:
build:
context: /var/www/ml/dockerize/vendor/myapp/myapp-on-docker
dockerfile: php-extensions
volumes:
- /var/www/ml/dockerize:/data/shop/development/current:rw
myapp-psql:
image: postgres:9.6.10
myapp-redis:
image: redis:3.2.6
ports:
- 10009:6379/tcp
myapp-web:
image: nginx:1.10.3
links:
- myapp-php
ports:
- 10080:80/tcp
volumes:
- /var/www/ml/dockerize/vendor/myapp/myapp-on-docker/conf/nginx/myapp:/etc/nginx/myapp:rw
- /var/www/ml/dockerize/vendor/myapp/myapp-on-docker/conf/nginx/conf.d:/etc/nginx/conf.d:rw
- /var/www/ml/dockerize:/data/shop/development/current:rw
version: '3.0'
steps to reproduce:
myapp volume / folder is NOT in /etc/nginx
ls -a /etc/nginx/
. .. conf.d fastcgi_params koi-utf koi-win mime.types modules nginx.conf scgi_params uwsgi_params win-utf
myapp volume / folder is available in /etc/nginx
ls -a /etc/nginx/
. .. conf.d fastcgi_params koi-utf koi-win mime.types modules myapp nginx.conf scgi_params uwsgi_params win-utf
N/A
Ubuntu Linux 18.04 LTS
based on what I could read on docker docs volume is correctly set up in docker-compose.yml file
Doc I'm referring to:
https://docs.docker.com/compose/compose-file/
which shows how to define volumes for a service (which my container is under)
running docker-compose build and docker-compose up doesn't solve the issue
restarting docker service doesn't solve the issue
@janmyszkier It would have been really helpful if you had followed the provided issue template. As it stands, I'm unable to reproduce the issue you describe after cloning your repo:
$ docker-compose up -d
Creating network "repro6158_default" with the default driver
Creating repro6158_myapp-redis_1 ... done
Creating repro6158_myapp-jenkins_1 ... done
Creating repro6158_myapp-elasticsearch_1 ... done
Creating repro6158_myapp-psql_1 ... done
Creating repro6158_myapp-php_1 ... done
Creating repro6158_myapp-web_1 ... done
(compose)joffrey@yuna:~/work/tests/compose/repro6158$ docker-compose exec myapp-web ls -la /etc/nginx
total 48
drwxr-xr-x 4 root root 4096 Aug 27 18:26 .
drwxr-xr-x 59 root root 4096 Aug 27 18:26 ..
drwxrwxr-x 2 1000 1000 4096 Aug 27 18:20 conf.d
-rw-r--r-- 1 root root 1007 Jan 31 2017 fastcgi_params
-rw-r--r-- 1 root root 2837 Jan 31 2017 koi-utf
-rw-r--r-- 1 root root 2223 Jan 31 2017 koi-win
-rw-r--r-- 1 root root 3957 Jan 31 2017 mime.types
lrwxrwxrwx 1 root root 22 Jan 31 2017 modules -> /usr/lib/nginx/modules
drwxrwxr-x 2 1000 1000 4096 Aug 27 18:20 myapp
-rw-r--r-- 1 root root 643 Jan 31 2017 nginx.conf
-rw-r--r-- 1 root root 636 Jan 31 2017 scgi_params
-rw-r--r-- 1 root root 664 Jan 31 2017 uwsgi_params
-rw-r--r-- 1 root root 3610 Jan 31 2017 win-utf
@shin- really sorry, updated the issue using the new template issue.
What else should I check & provide that could cause our results to be different?
EDIT:
OK this is what I possibly having issues with:
docker run -it nginx:1.10.3 bash - no myapp
BUT
docker-compose exec myapp-web ls -la /etc/nginx
DOES have the myapp folder.
Why is that? is docker and docker-compose not using same containers? in that case why they appear in docker container ls only after I run my docker-compose up?
Obviously, I'm missing something here that is not explained in the docs of docker-compose.
For information, I had the same issue with the latest version of docker + compose under windows.
Downgrading to a previous version solved the issue, so I believe it is just on the last version since I did not have the issue before.
@janmyszkier When you're doing docker run -it nginx:1.10.3 bash, it will start a new container without any of the configuration declared in your Compose file. It obviously won't show any volumes in there. My advice would be to review the docs about the difference between images and containers, what docker run does, and what docker-compose up does. If you're still unclear, there are great community resources that can help as well:
I am still puzzled by the fact that I had the same issue using docker-compose and downgrading my docker version from the 18.06 for Windows to an earlier version solved the issue.
I just upgraded the docker version with the same docker-compose.yml and after the upgrade the files were not mounted anymore in the container. This leads me to believe that there might be something going on here anyway.
@PierreReliquet If you've checked everything and are confident this is a bug, please create a new issue with the necessary details.
Most helpful comment
I am still puzzled by the fact that I had the same issue using
docker-composeand downgrading my docker version from the 18.06 for Windows to an earlier version solved the issue.I just upgraded the docker version with the same
docker-compose.ymland after the upgrade the files were not mounted anymore in the container. This leads me to believe that there might be something going on here anyway.