How to restart a single container with docker-compose

后端 未结 9 1870
失恋的感觉
失恋的感觉 2020-12-02 03:27

I have a docker-compose.yml file that contains 4 containers: redis, postgres, api, worker

During the development of worker, I often need to restart it i

9条回答
  •  忘掉有多难
    2020-12-02 04:15

    The answer's here are talking about the reflection of the change on the docker-compose.yml file.

    But what if I want to incorporate the changes I have done in my code, and I believe that will be only possible by rebuilding the image and that I do with following commands

    1. docker container stop

    docker stop container-id
    

    2. docker container removal

    docker rm container-id
    

    3. docker image removal

    docker rmi image-id
    

    4. compose the container again

    docker-compose up container-name
    

提交回复
热议问题