Reputation: 553
I have been stuck with docker not picking up any changes. So I released my app few days ago as v1.0.0.0 and obviously since its a sort of pre release i still have some bug fixes to do currently i'm already at v1.0.5.0. But for some reason every time I deploy it seem to run an old image and not the new one with my bug fix in it.
Firstly i'm not using ci/cd pipelines for the moment just everything manually(still learning)
What I do to run:
So i run docker-compose -f docker-compose.yml -f docker-compose-override.yml up -d
this works
when I want to redeploy i overwrite my files by deleting them and putting my new files in the folder i close my containers :
docker-compose -f docker-compose.yml -f docker-compose-override.yml down
and when everything is ready i'll start them again with:
docker-compose -f docker-compose.yml -f docker-compose-override.yml up -d
but for some reason when I do this it does not pickup the changes. I think it tries to load the old untagged image or something although when i run docker images list i get nothing
I can fix this kinda issue by deleting everything with:
docker rmi $(docker images -a -q)
this deletes everything and then i'll start my containers again and this start the new one. But obviously i'm not going to remove all my images everytime.
my webapp consist of a api, frontend in blazor and mvc app all in .net5.0 and production database running on another vm.
my compose:
version: '3.4'
services:
portfoliorepositoryapi:
image: ${DOCKER_REGISTRY-}portfoliorepositoryapi:${TAG:-latest}
container_name: "PortfolioApi"
ports:
- "5100:80"
- "5101:443"
- "1433:1433"
build:
context: .
dockerfile: PortfolioRepositoryApi/Dockerfile
portfolio-frontend:
image: ${DOCKER_REGISTRY-}portfoliofrontend:${TAG:-latest}
container_name: "PortfolioFrontend"
ports:
- "5104:80"
- "5105:443"
build:
context: .
dockerfile: Portfolio-Frontend/Dockerfile
volumes:
- ./Portfolio-Frontend/Files:/app/Files
cmsapp:
image: ${DOCKER_REGISTRY-}cmsapp:${TAG:-latest}
container_name: "CMSAPP"
ports:
- "5102:80"
- "5103:443"
build:
context: .
dockerfile: CMSApp/Dockerfile
What do I need to do so it picks up the changes?
Upvotes: 4
Views: 1790
Reputation: 1684
Try using --build
option of docker compose up
, as specified in the docs. There's also a --force-recreate
option available, which you may or may not find useful depending on your workflow.
In your case, your command would be something similar to:
docker-compose -f docker-compose.yml -f docker-compose-override.yml up --build -d
Upvotes: 4