I am using docker-compose
along with the docker-compose.yml
file as the final step of my ci/cd pipeline to create/re-create containers on a server.
Code example:
sudo docker-compose up --force-recreate --detach
sudo docker image prune -f --all --filter="label=is_image_disposable=true"
My goal is to deploy and keep several containers from the same repo but with a different tags on a single server.
The problem is that docker-compose seems to remove existing containers of my repo before it creates new ones, even tho the existing container has tag :dev
, and the new one has tag :v3
.
As an example: before docker-compose
command has been executed I had a running container named
my_app_dev
container of the repohub/my.app:dev
,
and after the docker-compose
command ran i have this
my_app_v3
container of the repohub/my.app:v3
.
What I do want to see in the end is both containers are up and running:
my_app_dev
container of the repohub/my.app:dev
my_app_v3
container of the repohub/my.app:v3
Can someone give me an idea how can I do that?