Reputation: 16445
In the following guide when establishing how to make data-only docker containers they use the docker create command:
docker create -v /dbdata --name dbdata training/postgres /bin/true
However, as far as I know, with docker-compose you can only run containers not just create them. Is there any way to currently to use docker create
in place of docker run
for certain containers?
Moreover are there any negative consequences to running a data-only container instead of simply creating it?
Upvotes: 2
Views: 317
Reputation: 16445
Currently the best way seems to be addressed by these two github issue threads:
https://github.com/docker/compose/issues/942
https://github.com/docker/compose/pull/1754
The addition of an option that doesn't run the containers is still under debate, but the solution for now seems to be to manually stop the container after running it
docker-compose <container-name> stop
You can also change the entrypoint in the .yml file to /bin/true if you don't want to deal with manually stopping it.
Upvotes: 1