Docker Community Forums

Share and learn in the Docker community.

Preferred way to run docker-compose in interactive mode

Expected behavior

I want to call docker-compose run service and be put into an interactive session.

Actual behavior

I get “Interactive mode is not yet supported on Windows”

Information

With the docker toolbox users would fire up an image with docker-compose running and run commands from it: https://gist.github.com/au-phiware/25213e72c80040f398ba I’m not sure how to replicate that in the new Docker for Windows world. I would think I could also start a service in daemon mode and attach to it but I’m unable to get that working in a simple container just running bash. Any guidance as to the preferred method for running docker-compose services interactively would be much appreciated.

@vanpelt We’re working on liberalizing this in docker-compose: https://github.com/docker/compose/pull/3274

Thanks for reporting!

2 Likes

I just wanted to mention I’m getting around this by bringing up my compose containers and attaching to them with docker exec -it flowerai_web_1 bash to run any one-off commands I happen to need.

1 Like

I’m with same problem.
I’m using Quickstart Terminal and docker-compose version 1.7.1, build 0a9ab35.
Thanks.

1 Like

you could try prefixing the command with winpty, which ships with git bash…YMMV though

All right. I’ll try this.

Thanks!

Sadly, don’t work!

@rneugeba: winpty did the job, tnx!

winpty docker exec -it mediawiki_web_1 bash

root@bd9007e832ec:/# ls
bin  boot  data  dev  entrypoint.sh  etc  home  lib  lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var

PS: I should add that I’ve added the following to my docker-compose.yml-file:

  stdin_open: true
  tty: true
3 Likes

It works fine,

I try with:

$ winpty docker exec -it --user www-data core bash
www-data@f5d8d4f0347f:/srv/app$ ls -la
total 33
drwxr-xr-x 2 root root 4096 Dec 19 17:09 .
drwxr-xr-x 3 root root 4096 Dec 16 19:09 …
-rwxr-xr-x 1 root root 35 Dec 19 16:10 .gitignore
-rwxr-xr-x 1 root root 209 Dec 19 17:09 composer.json
-rwxr-xr-x 1 root root 20792 Dec 19 17:11 composer.lock
drwxr-xr-x 2 root root 0 Dec 16 21:03 config
drwxr-xr-x 2 root root 0 Dec 19 15:57 docker
-rwxr-xr-x 1 root root 0 Dec 16 21:03 docker-compose.yml
drwxr-xr-x 2 root root 0 Dec 19 17:13 src
drwxr-xr-x 2 root root 0 Dec 19 17:11 vendor
drwxr-xr-x 2 root root 0 Dec 19 15:11 web

Thanks a lot!

absolutely the best solution.
stdin_open: true
tty: true
worked like a charm.
Thank you

1 Like