I think it was a mistake to add this command. It's lead to a lot of confusion, and duplication with up
. Instead of create
we should have added a --no-start
or --create-only
flag to up
.
Let's do that now and deprecate `create.
See #3394 and #2908
I'm not quite sure how a flag or a sub-command makes a difference or not. Given docker has docker create
command, I would vote for keeping it conceptually the same: Create resources, but don't start any containers.
(Also I was somewhat surprised to see that docker-copose up
wasn't implemented in terms of create && start
. But I haven't looked in detail at the code so I'm willing to accept there are reasons why that wouldn't work.)
+1 for keeping it, create
is much more meaningful than up --no-start/--create-only
, up
is supposed to get the container running
In my opinion, it is not only a matter of naming. Currently, there is two different behaviors:
docker-compose up
creates the containers, but also the volumes and the custom network in which all services defined in the docker-compose.yml
are part of.docker-compose create
creates the containers, the volumes but not the network.And for me, here lies the difference. In my opinion, either docker-compose create
should create the custom network, exactly like docker-compose up
, this way it is exactly the same behavior, it creates everything, _but it just doesn't start the containers_.
Or, for some reasons (which I currently can't think of, but maybe there are), the behavior of docker-compose create
is fine as it is, in which case, I think it makes sense to add a --no-run | --n-start
to docker-compose up
.
Because sometimes (albeit I'll admit, I took me some time with docker before I met the need -but I finally did) I need to have everything created, prepared, but I don't want the containers to run before my client validates his token (for instance).
What do you think?
IMHO, 'create' behaviour is not intuitive. I would expect it to create all resources, including networks. Exactly like @nschoe mentioned above, to create everything, but not to start.
Are there any plans to add/fix this functionality to 'create'? Thx!
@ilgarm What we're discussing in this issue is an alternative proposal. See #3394 and #2908 for context.
Is there any plan to clean this up?
+1 for changing create to create all resources. Is there even another way using docker-compose to create networks? I can't seem to find it if there is.
@timothysnave I use this as a workaround:
version: '2'
services:
create_network:
image: busybox
command: "true"
docker-compose up create_network > /dev/null
I didn't know you can use up with a service. That's exactly what I need, actually. Thanks!
Intuitive for me: at first prepare all stuff with build
, create
and then just start
when needed. But right now it fail on start
- no network autocreated.
Most helpful comment
In my opinion, it is not only a matter of naming. Currently, there is two different behaviors:
docker-compose up
creates the containers, but also the volumes and the custom network in which all services defined in thedocker-compose.yml
are part of.docker-compose create
creates the containers, the volumes but not the network.And for me, here lies the difference. In my opinion, either
docker-compose create
should create the custom network, exactly likedocker-compose up
, this way it is exactly the same behavior, it creates everything, _but it just doesn't start the containers_.Or, for some reasons (which I currently can't think of, but maybe there are), the behavior of
docker-compose create
is fine as it is, in which case, I think it makes sense to add a--no-run | --n-start
todocker-compose up
.Because sometimes (albeit I'll admit, I took me some time with docker before I met the need -but I finally did) I need to have everything created, prepared, but I don't want the containers to run before my client validates his token (for instance).
What do you think?