Search code examples
dockerboot2docker

docker run command output


I am just learning the basic basic docker commands by setting up in Ubuntu . By running the following command :

$sudo docker run -i -t tutum/hello-world /bin/bash

I get the output as :

root@1035h04e176:/# 

I dint understand whats going on here. I thought $docker run … /bin/bash will create a new container with the id as the output of the command , can somebody please tell me , has the container already created? If yes how to use it?


Solution

  • You used the -ioption. It runs the container in "interactive" mode : it attaches the standard input and outputs, and in this case (running /bin/bash) you're thus entering the container shell.

    If you don't want to attach any input/output stream to your current shell and only get it container ID, run it in "detach" mode:

    $sudo docker run -d -t tutum/hello-world /bin/bash
    4f812a7b4f0e0c681eb3616cb04d0797eda37e32d1e5b35f79dfa686d95b3aee