I'm running an application with docker compose.
version: '3.8'
services:
php:
build:
context: .
ports:
- "[::1]:${BACKEND_PORT}:80"
frontend:
build:
context: .
dockerfile: Dockerfile.frontend
ports:
- "[::1]:${FRONTEND_PORT}:80"
Whenever I change the source code I redeploy the application with docker compose up --build -d --remove-orphans
and I am relatively sure that it often works.
I just had a situation where the deploy didn't work, it would continue to run the old code. Come to think of it, I had this happen in the past but I never paid much attention and just continued making changes and re-deploying and in the end it always worked.
But this time there was only one change that I wanted to deploy and this time I'm absolutely sure that docker compose up --build -d --remove-orphans
did not correctly re-deploy the application. I ran it several times, cleared client-side caches, etc.
I then ran docker compose down --remove-orphans
followed by docker compose up --build -d --remove-orphans
and finally the application got deployed correctly.
Is docker compose up --build -d --remove-orphans
not enough to re-build the image and run it?