Wouldn’t it be better to run the docker compose down -d portal command before running the docker compose up -d portal command? Something like the following:
deploy-portal:
stage: deploy
script:
- cd /home/Projects/
- docker compose down -d portal
- docker compose up -d portal
What’s a runner? By default when using docker compose up, if something changed in the compose file, Docker will automatically stop the container an start a new container with the updated configuration.
Hello,
Thank you so much for your reply.
I mean GitLab Runner. When a change is made to the website code, the runner updates the changes, but since the old website is already running in Docker, will the docker compose up -d portal command show the new website?
It depends on your compose file. If params within change, it will restart.
If the image changes und you use latest tag, you need docker compose up -d --pull to always use the latest image. I think also compose has an option like pull: always.