How to pipe data to container sdtin?
test:
image: ubuntu
stdin_open: true
command: tailf /dev/null
echo hello | docker-compose run test cat
Doesn't work.
I know how to do it with docker exec
, but I'm interested in "compose-way" solution.
I can confirm this is the current behavior, docker-compose
freezes. It works if docker run
is called directly, though. I don't see a reason why docker-compose run
should differ from docker run
in this behavior.
I would love to see this fixed and volunteer to help, but first I'd like some feedback from the community to see if I'm on the right track since this would be my first contribution to docker-compose
.
I'm having issues with this as well. Is there a work around, other than just using the regular docker
command?
@blackrobot
I moved from docker-compose
to crowdr
This is working for me on master (with the example provided above).
We fixed some bugs in dockerpty
in june which probably fixed this. The fixes are in the 1.4.x releases.
I updated to docker-compose
version 1.4.2 and can confirm that the issue no longer happens. Thanks for the great work, everyone!
Traceback (most recent call last):
File "/usr/local/bin/docker-compose", line 11, in
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 88, in main
command()
File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 140, in perform_command
handler(command, command_options)
File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 485, in exec_command
pty.start()
File "/usr/local/lib/python2.7/dist-packages/dockerpty/pty.py", line 338, in start
io.set_blocking(pump, flag)
File "/usr/local/lib/python2.7/dist-packages/dockerpty/io.py", line 32, in set_blocking
old_flag = fcntl.fcntl(fd, fcntl.F_GETFL)
ValueError: file descriptor cannot be a negative integer (-1)
Most helpful comment
Traceback (most recent call last):
File "/usr/local/bin/docker-compose", line 11, in
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 88, in main
command()
File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 140, in perform_command
handler(command, command_options)
File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 485, in exec_command
pty.start()
File "/usr/local/lib/python2.7/dist-packages/dockerpty/pty.py", line 338, in start
io.set_blocking(pump, flag)
File "/usr/local/lib/python2.7/dist-packages/dockerpty/io.py", line 32, in set_blocking
old_flag = fcntl.fcntl(fd, fcntl.F_GETFL)
ValueError: file descriptor cannot be a negative integer (-1)