My docker-compose.yml is:
version: '2'
services:
joomla:
image: joomla
links:
- joomladb:mysql
volumes:
- "./www:/var/www/html"
ports:
- 9010:80
environment:
MYSQL_PORT_3306_TCP: 3306
JOOMLA_DB_HOST: joomladb
JOOMLA_DB_PASSWORD: "example"
JOOMLA_DB_USER: "root"
JOOMLA_DB_NAME: "joomla"
joomladb:
image: mysql:5.6
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: "example"
MYSQL_DATABASE: "joomla"
volumes:
- "./db:/var/lib/mysql"
phpmyadmin:
image: phpmyadmin/phpmyadmin
ports:
- 9011:80
environment:
MYSQL_ROOT_PASSWORD: "example"
MYSQL_DATABASE: "joomla"
container_name: phpmyadmin
/var/www/html is mounted in the host (dir www) with all the joomla files. However host directory ./db is not even created.
However if I get into db container, directory is not empty:
root@docker1:/home/juanda/soplaelcierzo# docker exec -t -i 959 /bin/bash
root@95926c23f49a:/# cd /var/lib/mysql/
root@95926c23f49a:/var/lib/mysql# ls
auto.cnf ib_logfile0 ib_logfile1 ibdata1 joomla joomladb mysql performance_schema
I was getting a warning I didn't see:
WARNING: Service "joomladb" is using volume "/var/lib/mysql" from the previous container. Host mapping "/home/juanda/soplaelcierzo/db" has no effect. Remove the existing containers (with docker-compose rm joomladb
) to use the host volume mapping.
this issue could when e.g. there are 2 similar folders with the same project. So when you run docker-composer in first folder it bind its local folder "./db" to container volume. If after that try to run in another folder it try to bind another folder to the same container path. So advice above about
docker-compose rm joomladb
should help
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With