'How can I run two different docker.compose.yml file [closed]
currently I'am working on two project and these projects have different docker compose files but when I run docker compose up -d command it doesn't run correct containers. I mean
If I run docker compose in x project. It stil up containers belongs to b project running. How can I fix this issue. Thank you.
I Tried
docker compose up -
docker compose up -d --remove-orphans
Solution 1:[1]
If you want to run them simultaneously - Try to use different names and ports for the containers/services.
If you want to run them at different occasions -
Stop previous project with docker-compose down then start other with docker-compose up --force-recreate --remove-orphans -d
To persist the use volumes declaration the docker-compose. for example observe the cms-content in below snippet
version: "3.0"
services:
web:
image: ghost:latest
ports:
- "2368:2368"
volumes:
- cms-content:/var/lib/ghost/content
volumes:
cms-content:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
