Open aecobb53 opened 3 years ago
To use multiple override files, or an override file with a different name, you can use the -f
option to specify the list of files. Compose merges files in the order they’re specified on the command line. See the docker-compose
command reference for more information about using-f
.
can have multiple Dockerfiles but they need to be in different directories
docker-compose.yml
docker
├── web
│ └── Dockerfile
└── db
└── Dockerfile
version: '3'
services:
web:
# will build ./docker/web/Dockerfile
build: ./docker/web
ports:
- "5000:5000"
volumes:
- .:/code
db:
# will build ./docker/db/Dockerfile
build: ./docker/db
ports:
- "3306:3306"
redis:
# will use docker hub's redis prebuilt image from here:
# https://hub.docker.com/_/redis/
image: "redis:alpine"
# The following command will create and start all containers in the background
# using docker-compose.yml from current directory
docker-compose up -d
# get help
docker-compose --help
in case you need in the directory above
version: '3'
services:
web:
build:
context: .
dockerfile: ./docker/web/Dockerfile
ports:
- "5000:5000"
volumes:
- .:/code
maybe use docker-compose install??
docker-compose -f ./docker-compose.yml -f ./somewhereelse/docker-compose.yml -f ./1/2/3/docker-compose.yml up
?