I have a Dockerfile
with the following contents:
FROM <docker-registry>/<image>:latest
COPY mv setup /root/
RUN setup
When I do a docker-compose up -d
, Docker pulls the image and executes the steps.
When I do a docker-compose stop
and bring it back up, docker-compose dos not pull the latest image again. This is a problem for me as I will need a new image to be downloaded. The only way for me to do this is to blow up boot2docker vm and start over again.
You should use docker-compose pull
command to pull remote image, use docker-compose build
command to build local image,
then use docker-compose up -d
to recreate your container.
$ cd /path/to/folder
$ cat docker-compose.yml
myapp:
build: .
links:
- redis
redis:
image: redis
# pull lastest image
$ docker-compose pull redis
# build your image
$ docker-compose build myapp
# recreate containers
$ docker-compose up -d
Docker Compose version 1.5.0rc1 can now pull latest images referenced in Dockerfiles on build by using docker-compose build --pull
.
Before 1.5.0rc1 docker-compose
could not force a Dockerfile service to get the latest image. I had to use docker pull <image>
.
Once the new imaged has been pulled, then you can rebuild with docker-compose build
. Cache should be totally invalidated because step 0's FROM hash has changed, if the image has changed.
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