how can I create a data-container only using docker-compose.yml?

前端 未结 3 1994
攒了一身酷
攒了一身酷 2020-12-29 21:53

This question is coming from an issue on the Docker\'s repository:
https://github.com/docker/compose/issues/942

I can\'t figure it out how to create a data conta

3条回答
  •  青春惊慌失措
    2020-12-29 22:36

    A data only container (DOC) is a container that is created only to serve as a volume provider. The container itself has no function other than that other containers can mount it's volume by using the volumes_from directive.

    The DOC has to run only once to create the volume. Other containers can reference the volumes in it even if it's stopped.

    The OP Question: The docker-compose.yml starts the DOC every time you do a docker-compose up. OP asks for an option to only create container and volume, and not run it, using some sort of an create_only: true option.

提交回复
热议问题