I have a docker-compose.yml file which takes the image svka4019/notes2:latest from the docker hub. However, if I change the image build it and push it, when I run docker-compose it just uses the one it has already downloaded before. Here is the docker-compose.yml:
springboot-docker-compose-app-container:
image: svka4019/notes2:latest
ports:
- "80:5001"
depends_on:
- friendservice
networks:
- mynet
container_name: base_notes
friendservice:
build: ./Pirmas
command: python app.py
ports:
- 5000:5000
container_name: friend
networks:
- mynet
networks:
mynet:
And the command I use for building and running: docker-compose up --build -d
.
For updating the image in docker-hub I use:
docker build -t svka4019/notes2
docker push svka4019/notes2
If I use methods as no-cache it just rebuilds friendService container and skips the base one.
As @DazWilkin pointed out in the comments, using latest tag should be used carefully. Not only can it introduce bugs in your app if latest comes with BC breaks, but it also doesn't indicate that a new update must be performed on your machine if you already have an image 'latest'.
In your case, what you have to do should you want to keep using latest, is to simply call:
docker-compose pull
In case you are building your own image, then you must do:
docker-compose build --pull
The latter will tell docker-compose to first pull the base image before building your custom image.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With