How to start a docker container (ubuntu image) -


how stat docker container. had created using docker run -d -p -v /users/bsr:/usr/local/users --name test ubuntu have virtual box guest addition installed, , mounting works. but, not sure why can't keep shell running.

bsr[~/tmp/web] $ docker ps -a container id        image               command             created             status                     ports                   names cf620ff6c36a        ubuntu:latest       "/bin/bash"         2 hours ago         exited (0) 2 minutes ago                           test                 8213c8d49842        nginx:latest        "nginx"             3 hours ago         hour           0.0.0.0:49154->80/tcp   web                  bsr[~/tmp/web] $ docker start test test bsr[~/tmp/web] $ docker ps -a container id        image               command             created             status                     ports                   names cf620ff6c36a        ubuntu:latest       "/bin/bash"         2 hours ago         exited (0) 2 seconds ago                           test                 8213c8d49842        nginx:latest        "nginx"             3 hours ago         hour           0.0.0.0:49154->80/tcp   web                  bsr[~/tmp/web] $  

edit:

it may because command (/bin/bash ??) finishes immediately. when tried,

docker run -d -p -v /users/bsr:/usr/local/users --name test5 ubuntu /bin/bash -c "while true; echo hello world; sleep 1; done" 

i terminal. isn't there way start container , terminal ??

if want run interactive process, should use -i (keep stdin open in case detach) , -t (allocate pseudo-tty) flags:

docker run -it ubuntu  

you can @ the docs more information on flags , usage.


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -