0

when i try to mount a host directory as data volume in docker its not mount any directory to docker container(image). When i run

sudo docker run -t -i --name web -v /home/rponna/src/webapp:/opt/webapp ramnathreddy

it returns container id

7dcc03c397d56514015220a073c9e951478bf84aceb90b880bb93a5716079212

But when i run that container it will not show any files in opt/webapp (its empty).

Ramnath Reddy
  • 605
  • 1
  • 5
  • 10
  • when the container is running try this: "docker exec -i -t web /bin/bash" this will execute /bin/bash as second command in your container and attaches you over a tty. Then you will be in the running container and you can inspect the volumes. – Rene M. Apr 01 '15 at 08:25
  • when i run sudo docker exec -i -t web /bin/bash FATA[0000] Error response from daemon: Container web is not running $ sudo docker start web web $ sudo docker ps -l CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 09977f0f8684 ramnath:latest "/bin/bash" 3 minutes ago Exited (0) 9 seconds ago web $ sudo docker exec -i -t web /bin/bash FATA[0000] Error response from daemon: Container web is not running – Ramnath Reddy Apr 01 '15 at 09:01
  • if you can't run exec, it looks like your container has exited. can you post the output from ```docker logs web``` ? – booyaa Apr 01 '15 at 10:48
  • Correct, your container is broken and can't start as deamon "-d". Start your container as interactive, by replacing "-d" with "-i -t". Then you will see all outputs of the container in your shell. – Rene M. Apr 01 '15 at 11:17
  • When i run "$ sudo docker run -d -P --name web -v /dockerdatavolume/src/webapp:/dockerhostdatavolue/opt/webapp ramnathreddy " it returns "acbf548f7f209a21bca4cb9631aee80ae80e7853724e9a8c0e4446718cf4e61c "(container ). I commit that container as image with "$ sudo docker commit acbf548f7f2 ramnath" it returns "cfd4915e8317ca7a0350c70ccd101838dbc4528d711209a922ae06abcd9e6f09" Again open that image with command but it will not mount any host directory in to container $ sudo docker run -t -i ramnath bash – Ramnath Reddy Apr 03 '15 at 06:37

0 Answers0