MiquelAdell

Docker volume test

Jan 21st, 2016
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.14 KB | None | 0 0
  1. ➜  test git:(master) ./test.sh
  2.  
  3. # remove container if running
  4. $ docker rm -f test_test_1
  5.  
  6. test_test_1
  7.  
  8. # build image
  9. $ docker build --no-cache -t test .
  10.  
  11. Sending build context to Docker daemon 62.98 kB
  12. Step 1 : FROM php:7.0.2-apache
  13.  ---> 2f16964f48ba
  14. Step 2 : VOLUME /var/www/html/
  15.  ---> Running in 5de873648f49
  16.  ---> 428c0f421bff
  17. Removing intermediate container 5de873648f49
  18. Step 3 : RUN touch /var/www/html/file_generated_inside_the_container
  19.  ---> Running in 801429d9ba1f
  20.  ---> 86c70bf6635d
  21. Removing intermediate container 801429d9ba1f
  22. Successfully built 86c70bf6635d
  23.  
  24. # build container
  25. $ docker-compose up -d
  26.  
  27. Creating test_test_1
  28.  
  29. # list local files
  30. $ ls -al html
  31.  
  32. total 0
  33. drwxr-xr-x  3 miqueladell  staff  102 Jan 21 15:25 .
  34. drwxr-xr-x  8 miqueladell  staff  272 Jan 21 16:12 ..
  35. -rw-r--r--  1 miqueladell  staff    0 Jan 21 15:22 file_from_local_filesystem
  36.  
  37. # list container files
  38. $ docker exec -i -t test_test_1 ls -alR /var/www/html
  39.  
  40. /var/www/html:
  41. total 4
  42. drwxr-xr-x 1 1000 staff  102 Jan 21 14:25 .
  43. drwxr-xr-x 4 root root  4096 Jan  7 18:05 ..
  44. -rw-r--r-- 1 1000 staff    0 Jan 21 14:22 file_from_local_filesystem
Advertisement
Add Comment
Please, Sign In to add comment