Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

ability to start weave-networked containers in foreground, and auto-remove them #251

Closed
rade opened this issue Nov 28, 2014 · 4 comments
Closed
Labels
Milestone

Comments

@rade
Copy link
Member

rade commented Nov 28, 2014

It's somewhat inconvenient, and inconsistent with established docker behaviour, that weave run always detaches from the container. Ideally we'd like to mirror docker run behaviour, i.e. attach unless -d is specified.

The reason we always detach is that we need to perform most of the weave container networking configuration after the container has started (until #47 is resolved).

@rade rade added the feature label Nov 28, 2014
@rade
Copy link
Member Author

rade commented Nov 28, 2014

One quick hack here would be to run docker attach after we've done the network configuration. But @squaremo pointed out that this will result in any output prior to the attach getting lost.

Looking at the docker API, there's actually no such thing as run. Instead we have create, which starts the container and takes a whole bunch of options regarding attaching to stdin/out/err, and attach, which streams stdin/out/err. I am guessing docker run is implemented in terms of these two.

This suggests that, when the correct options are given to create, output from the container is buffered so it becomes available in a subsequent attach. Therefore, weave could start the container with create, then perform all the network configuration, and then attach.

Can't see how we'd do all that in a shell script though.

@rade
Copy link
Member Author

rade commented Nov 28, 2014

I am guessing docker run is implemented in terms of these two [create and attach]

Actually, create doesn't start the container; that is done by start. The sequencing for run is create -> attach -> start. Note that even though the container process isn't started until start, it appears one can attach to the container after create via the API but not the CLI.

We'd have to do something similar in weave, i.e. create, attach and start streaming input/output, start, and then configure container networking.

@yaronr
Copy link

yaronr commented Nov 29, 2014

+1, will make life a whole lot easier for CoreOS / systemd

@errordeveloper
Copy link
Contributor

I'd like to note that there one additional limitation of Docker that comes to play:

--rm=false                 Automatically remove the container when it exits (incompatible with -d)

@rade rade changed the title make weave run operate in foreground mode by default, just like docker run ability to start weave-networked containers in foreground May 16, 2015
@rade rade changed the title ability to start weave-networked containers in foreground ability to start weave-networked containers in foreground, and auto-remove them May 16, 2015
@rade rade closed this as completed in 8b66b8a May 19, 2015
@rade rade modified the milestone: 0.11.0 May 24, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants