We have various docker-compose files that create a service infrastructure. My question is if it is possible to only create the volumes defined in the compose file without creating the containers?
CodePudding user response:
It might be possible without starting any services.
command can be provided like this.
docker-compose up --no-start --no-deps
Or it's possible to specify individual volume.
docker-compose up --no-deps -d --volume <volume-name>
CodePudding user response:
You can use a docker-compose.override.yml
file with invalid entrypoints or different image (use a small template image) for those containers, that way they'll die immediately.
docker-compose.override.yml:
<conatiner-name>:
image: hello-world
command: "/hello"
restart: "no"