How to get docker-compose to always re-create containers from fresh images?

0 votes

My docker images are built on a Jenkins CI server and are pushed to our private docker repo. I am currently using docker-compose 1.3.2 as well as 1.4.0 on different machines but we’ve also used older versions previously. I always used the docker-compose pull && docker-compose up -d commands to fetch the fresh images from the registry and start them up. After a point docker-compose up started to re-run previously stopped containers instead of starting the originally built images every time.

Why is this happening all of a sudden.

Jul 27, 2018 in Docker by Hannah
• 17,070 points

1 answer to this question.

0 votes

The containers are getting recreated to preserve any data volumes that might be used.

If you’re doing CI, you don’t need this.

Hence just removing everything might solve the problem

docker-compose rm -f
docker-compose pull
docker-compose up --build -d
# Run some tests
docker-compose stop -t 1
answered Jul 27, 2018 by Kalgi
• 45,910 points

Related Questions In Docker

0 votes
2 answers
0 votes
1 answer

How to obtain the Docker container's IP address from the host?

This can be done by executing the ...READ MORE

answered Jul 16, 2018 in Docker by Sophie may
• 9,870 points
0 votes
1 answer

How to get a browsable url from Docker-for-mac or Docker-for-Windows?

LoadBalancer will work on Docker-for-Mac and Docker-for-Windows ...READ MORE

answered Oct 10, 2018 in Docker by Tyrion anex
• 8,310 points
0 votes
1 answer
0 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 57,300 points
0 votes
1 answer

Docker, how to get container information from within the container?

I've found out that the container id ...READ MORE

answered Jul 31, 2018 in Docker by Kalgi
• 45,910 points
0 votes
1 answer

How to create a container and run images in docker?

Look for what all images you have ...READ MORE

answered Feb 22 in Docker by Kalgi
• 45,910 points