I have a non-default docker-compose file name (docker-compose-test.yml). There is only one service defined in it.
I am starting the container using "docker-compose -f docker-compose-test.yml up"
I am trying to stop the container started above using docker-compose down, but it is not working.
I am getting below error,
ERROR: Can't find a suitable configuration file in this directory or any parent. Are you in the right directory? Supported filenames: docker-compose.yml, docker-compose.yaml
I understand that it is looking for default docker compose file name. Is there a way to specify the custom config file name during docker-compose down?
The default filename is docker-compose. yml . You can name the manifest name as you like, but you have to pass the filename in the docker-compose command.
The Compose file is a YAML file defining services, networks and volumes. The default path for a Compose file is ./docker-compose.yml .
Docker compose uses the Dockerfile if you add the build command to your project's docker-compose. yml. Your Docker workflow should be to build a suitable Dockerfile for each image you wish to create, then use compose to assemble the images using the build command.
docker-compose down - command will stop running containers, but it also removes the stopped containers as well as any networks that were created. You can take down one step further and add the -v flag to remove all volumes too.
You should run the docker-compose down
command with the same flags that when you started the containers.
docker-compose -f docker-compose-test.yml down
You can create a .env file and add the following:
COMPOSE_FILE=docker-compose-test.yml
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