I have run docker-compose up -d
command but volume directories are empty on host.
- Ubuntu 20.04
- docker-compose up -d
- page is displayed in the browser as expected
- docker volume inspect shows this:
{
"CreatedAt": "2020-08-29T22:26:49+01:00",
"Driver": "local",
"Labels": null,
"Mountpoint": "/var/lib/docker/volumes/magento-sandbox_magento_data/_data",
"Name": "magento-sandbox_magento_data",
"Options": null,
"Scope": "local"
}
]
- Image: https://hub.docker.com/r/bitnami/magento/
- yml file (
/home/tomas/Documents/Projects/Magento/magento-sandbox
):
version: '2'
services:
mariadb:
image: 'docker.io/bitnami/mariadb:10.3-debian-10'
environment:
- ALLOW_EMPTY_PASSWORD=yes
- MARIADB_USER=tomas
- MARIADB_PASSWORD=tomas
- MARIADB_DATABASE=magento_sandbox
volumes:
- 'mariadb_data:/home/tomas/Documents/Projects/Magento/magento-sandbox/db'
magento:
image: 'docker.io/bitnami/magento:2-debian-10'
environment:
- MARIADB_HOST=mariadb
- MARIADB_PORT_NUMBER=3306
- MAGENTO_DATABASE_USER=tomas
- MAGENTO_DATABASE_PASSWORD=tomas
- MAGENTO_DATABASE_NAME=magento_sandbox
- ELASTICSEARCH_HOST=elasticsearch
- ELASTICSEARCH_PORT_NUMBER=9200
ports:
- '80:80'
- '443:443'
volumes:
- 'magento_data:/home/tomas/Documents/Projects/Magento/magento-sandbox/webroot'
depends_on:
- mariadb
- elasticsearch
elasticsearch:
image: 'docker.io/bitnami/elasticsearch:6-debian-10'
volumes:
- 'elasticsearch_data:/home/tomas/Documents/Projects/Magento/magento-sandbox/elasticsearch/data'
volumes:
elasticsearch_data:
driver: local
mariadb_data:
driver: local
magento_data:
driver: local
- All containers are running (docker ps command verifies this)
Why my /home/tomas/Documents/Projects/Magento/magento-sandbox/webroot is empty? I mean why mountpoint is not reflecting the configuration in the file?
How to achieve the result where this directory contains all the files used to render the page in the browser?
2
Answers
I have managed to find the problem and it turned out to be multiple ones.
I have fixed all of these and it worked. However after all up and running, my elasticsearch failed again but this is another issue and is not related to this one.
Thank you, guys, for your support and effort.
Uhm you did create volumes but you did not asign any source paths to them. So they are stored in the default path. (under ubuntu I know it is /var/lib/docker/volumes/HERE). Anyway you will have to find out where the data you want to mount is stored on the docker machines. (you normally set the paths in dockerfiles)
Anyway, the correct syntax is
Once you have found that out go ahead and create a .env file in your diretory where your container and compose is stored. It contains
We will use these variable to get a somehwat cleaner docker-compose file.
In your compose we will specify volumes using the following attributes:
( I hope one example makes it clear enough)
greetings