Using the official MySQL Docker image, I donโt understand how to mount the data directory to a specific point on the host. Dockerfile Image Sets
VOLUME /var/lib/mysql
therefore, database data must be stored "somewhere" on the host. I want to be more specific in my docker creation file, so I tried the following:
mysql: image: mysql:5.7 environment: - MYSQL_ROOT_PASSWORD=password - MYSQL_DATABASE=mydb volumes: - ./database/mysql:/var/lib/mysql
Starting with docker-compose up everything works fine, but the directory. / database / mysql on the host remains empty, while / var / lib / mysql in the container contains data. Is there a problem in my configuration? Or am I misunderstanding how to use volumes?
source share