Is this expected behavior or a bug?
While running docker-compose up
, my volumes are created on my local machine. But when running docker-compose -d
up, they are not.
This is the part in the docker-compose file that's causing problems:
test-mysql:
image: mysql:5.7
container_name: test-mysql
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=test
- MYSQL_USER=test
- MYSQL_PASSWORD=root
ports:
- 3306:3306
volumes:
- ../www/data/mysql:/var/lib/mysql
So when running docker-compose up
for the first time, the ../www/data/mysql folder gets created.
But, If I try this with docker-compose up -d
, the folder does not get created.
docker-compose up command will pull mysql image when you will run docker-compose up first time, next time it will use the same image , which is now saved locally.
So docker-compose up with or without -d will create the folder www , try doing it with -d first , it will create www folder.
-d options just process your request in background.
Hope it will help!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.