Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker-compose up interactive mode #3081

Closed
MitchK opened this issue Mar 4, 2016 · 5 comments
Closed

docker-compose up interactive mode #3081

MitchK opened this issue Mar 4, 2016 · 5 comments

Comments

@MitchK
Copy link

MitchK commented Mar 4, 2016

I have this in my Dockerfile:

...
CMD bash on-start.sh

I can run it using this and I get an interactive shell as desired.

$ docker run -it imagename
$ _

But it does not work when doing this:

$ docker-compose up
...
exited with code 0

If I do this, it works as well, but dependent services are not started.

$ docker-compose run myservice 
$ _

My versions:

$ docker --version
Docker version 1.10.0, build 590d5108
$ docker-compose --version
docker-compose version 1.6.0, build d99cad6
@josephearl
Copy link

You probably want to use stdin_open: true in your Compose file.

@dnephin
Copy link

dnephin commented Mar 7, 2016

That is expected behaviour. up is not interactive. It can start multiple containers, so you can't have a single terminal that has stdin open for multiple containers.

run should do what you want. If you use depends_on it will start dependencies as of Compose 1.6.2 (the bug was fixed in compose 1.6.1), so you'll need to upgrade as well.

@zipzit
Copy link

zipzit commented Jan 29, 2018

@dnephin
Daniel, I have to thank you for your note on this topic. I've been struggling for two days to get a container to function in an interactive mode on a Node server where I also need to input some data via the terminal on the back end. The wording of your note got me to look at my issue from a different direction. A long slow read of the docker compose details (including the run method) really worked for me. Many thanks.

@jsheedy
Copy link

jsheedy commented Oct 25, 2018

I wanted to get interactive access to the Python debugger pdb running in a docker-compose environment. TIL I can do that with docker attach myservice

@bam80
Copy link

bam80 commented Dec 25, 2021

That is expected behaviour. up is not interactive.

@dnephin
Daniel, I have to thank you for your note on this topic. I've been struggling for two days to get a container to function in an interactive mode on a Node server where I also need to input some data via the terminal on the back end.

@dnephin
That probably should be pointed out in the documentation explicitly.
I've been struggled for two days or so too, without obvious reason why it doesn't work, until I faced the question on SO suddenly:
https://stackoverflow.com/questions/53106678/docker-compose-up-and-user-inputs-on-stdin

And also, podman-compose up (which I used for actual composing) does work in interactive mode which makes things even more confusing..

PS:

You probably want to use stdin_open: true in your Compose file.

That didn't help to the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants