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

后端 未结 7 2105
误落风尘
误落风尘 2020-11-29 15:13

My docker images are built on a Jenkins CI server and are pushed to our private Docker Registry. My goal is to provision environments with docker-compose which always start

7条回答
  •  抹茶落季
    2020-11-29 15:53

    By current official documentation there is a short cut that stops and removes containers, networks, volumes, and images created by up, if they are already stopped or partially removed and so on, then it will do the trick too:

    docker-compose down
    

    Then if you have new changes on your images or Dockerfiles use:

    docker-compose build --no-cache
    

    Finally:docker-compose up

    In one command: docker-compose down && docker-compose build --no-cache && docker-compose up

提交回复
热议问题