I start to work with a new project using Docker and I can see there is no docker-compose.yml
file there, but a few files like docker-compose.myname1.yml
, docker-compose.myname2.yml
instead. Trying to run docker-compose up
I get an 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
So I wonder if that's possible for a Docker project to work without the docker-compose.yml
file and if it is, what conditions should be met. Maybe that's the matter of some specific version or environment?
https://docs.docker.com/compose/reference/
"Options: -f, --file FILE Specify an alternate compose file (default: docker-compose.yml)"
so in your case that would be:
docker-compose up -f dockcer-compose.myname1.yml
docker-compose up -f dockcer-compose.myname2.yml
There are two different issues presented in your question:
docker-compose up
, you must be in a directory that contains docker-compose.yml
(or '.yaml
), as indicated by the error you are receiving.COMPOSE_FILE
is set to something else.In order to use an alternative file, you can take one of these approaches:
docker-compose
with the --file
argument:$ docker-compose --help
-f, --file FILE Specify an alternate compose file
(default: docker-compose.yml)
COMPOSE_FILE
environment variable prior to running any docker-compose
command.
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.