`docker-compose up` creating containers under one parent folder/ directory in docker desktop app

98 Views Asked by At

I have this docker-compose.yml. When I am running command docker-compose up the containers are created properly but under one parent folder of docker desktop. I do not want my containers to be under that parent folder. I want them free containers at root. How to achieve it?

Providing image 1 where my docker-compose.yml present enter image description here

Providing image 3 of my docker desktop enter image description here

1

There are 1 best solutions below

0
DevEzro On

By default the docker-compose command creates the containers under the project name you are in. Use docker-compose -p . up, where -p is the project name. You can use --project-name in stead to specify it. It uses . to told him to create in the actual directory. Replace it with the path you want. Finally I imagine you know that up is for create and run the contanier.

Hope this can help you :)