Last active
December 20, 2015 06:18
-
-
Save metalivedev/6084290 to your computer and use it in GitHub Desktop.
Playing with stdin and out on a docker container
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vagrant@precise64:~/src/wctest$ cat Dockerfile | |
FROM base | |
ENTRYPOINT ["wc"] | |
vagrant@precise64:~/src/wctest$ cat Dockerfile | docker run -i rufus/wc - | |
vagrant@precise64:~/src/wctest$ docker ps -a | |
ID IMAGE COMMAND CREATED STATUS PORTS | |
44c791634de4 rufus/wc:latest wc - 8 seconds ago Exit 0 | |
969d44ad3004 rufus/wc:latest wc - 2 minutes ago Exit 0 | |
cef084dba8ec rufus/wc:latest wc - 2 minutes ago Up 2 minutes | |
a6f7de006f2a rufus/wc:latest wc - 6 minutes ago Exit 0 | |
65b8e225c01a rufus/wc:latest wc - 13 minutes ago Up 13 minutes | |
85de1d2d6397 rufus/wc:latest wc - 14 minutes ago Exit 0 | |
c81cbac8958a rufus/wc:latest wc - 15 minutes ago Exit 0 | |
0d71f1efe01b base:latest wc /bin/sh -c #(nop) 15 minutes ago Exit 0 | |
vagrant@precise64:~/src/wctest$ docker logs 44c791634de4 | |
3 4 29 - | |
vagrant@precise64:~/src/wctest$ | |
# Ok, adding more CMDs, like -c | |
vagrant@precise64:~/src/wctest$ cat Dockerfile | docker run -i rufus/wc -c | |
vagrant@precise64:~/src/wctest$ docker ps -a | |
ID IMAGE COMMAND CREATED STATUS PORTS | |
92dc1950177f rufus/wc:latest wc -c 5 seconds ago Exit 0 | |
44c791634de4 rufus/wc:latest wc - 2 minutes ago Exit 0 | |
969d44ad3004 rufus/wc:latest wc - 3 minutes ago Exit 0 | |
cef084dba8ec rufus/wc:latest wc - 4 minutes ago Up 4 minutes | |
a6f7de006f2a rufus/wc:latest wc - 8 minutes ago Exit 0 | |
65b8e225c01a rufus/wc:latest wc - 15 minutes ago Up 15 minutes | |
85de1d2d6397 rufus/wc:latest wc - 16 minutes ago Exit 0 | |
c81cbac8958a rufus/wc:latest wc - 17 minutes ago Exit 0 | |
0d71f1efe01b base:latest wc /bin/sh -c #(nop) 17 minutes ago Exit 0 | |
vagrant@precise64:~/src/wctest$ docker logs 92dc1950177f | |
29 | |
vagrant@precise64:~/src/wctest$ |
According to kstaken, this works fine on the latest build from master branch, and the output from wc goes to stdout
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I expected the output from the docker run to show up on stdout, just like it did when running the same commands on the host.