Reuse containers with `docker-compose`

前端 未结 1 908
忘了有多久
忘了有多久 2021-01-18 05:55

I\'ve an app running on multiple Docker containers defined by docker-compose. Everything works fine from my user and the docker-compose ps output l

相关标签:
1条回答
  • 2021-01-18 06:09

    Compose will always reuse containers as long as their config hasn't changed.

    If you have any state in a container, you need to put that state into a volume. Containers should be ephemeral, you should be able to destroy them and recreate them at any time without losing anything.

    If you need to initialize something I would do it in the Dockerfile, so that it's preserved in the image.

    0 讨论(0)
提交回复
热议问题