From 539f8aa082dd5dc451fc88e8506e9f9d30268aa8 Mon Sep 17 00:00:00 2001 From: sicwolf Date: Sat, 8 Oct 2016 18:52:15 +0800 Subject: [PATCH 1/2] Wrong destination folder in container /opt/webapp of web container includes app.py, if set destination folder as /opt/webapp, app.py is not visible and below error log presents, so it's better to set the destination folder as /webapp. docker logs -f web python: can't open file 'app.py': [Errno 2] No such file or directory --- engine/tutorials/dockervolumes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/tutorials/dockervolumes.md b/engine/tutorials/dockervolumes.md index 2fb53870480..8dd0c9d7cf7 100644 --- a/engine/tutorials/dockervolumes.md +++ b/engine/tutorials/dockervolumes.md @@ -99,7 +99,7 @@ In addition to creating a volume using the `-v` flag you can also mount a directory from your Docker engine's host into a container. ```bash -$ docker run -d -P --name web -v /src/webapp:/opt/webapp training/webapp python app.py +$ docker run -d -P --name web -v /src/webapp:/webapp training/webapp python app.py ``` This command mounts the host directory, `/src/webapp`, into the container at From 96eec5a7b90c0860cccaf386e14c82d8bccde5e4 Mon Sep 17 00:00:00 2001 From: Water Wang Date: Tue, 11 Oct 2016 09:54:25 +0800 Subject: [PATCH 2/2] Update dockervolumes.md - Changed all wrong /opt/webapp Changed all wrong /opt/webapp as /webapp /opt/webapp of web container includes app.py, if set destination folder as /opt/webapp, app.py is not visible and below error log presents and the web container will exit, so it's better to set the destination folder as /webapp. docker logs -f web python: can't open file 'app.py': [Errno 2] No such file or directory --- engine/tutorials/dockervolumes.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/engine/tutorials/dockervolumes.md b/engine/tutorials/dockervolumes.md index 8dd0c9d7cf7..3ee582f5474 100644 --- a/engine/tutorials/dockervolumes.md +++ b/engine/tutorials/dockervolumes.md @@ -103,7 +103,7 @@ $ docker run -d -P --name web -v /src/webapp:/webapp training/webapp python app. ``` This command mounts the host directory, `/src/webapp`, into the container at -`/opt/webapp`. If the path `/opt/webapp` already exists inside the container's +`/webapp`. If the path `/webapp` already exists inside the container's image, the `/src/webapp` mount overlays but does not remove the pre-existing content. Once the mount is removed, the content is accessible again. This is consistent with the expected behavior of the `mount` command. @@ -152,7 +152,7 @@ Docker volumes default to mount in read-write mode, but you can also set it to be mounted read-only. ```bash -$ docker run -d -P --name web -v /src/webapp:/opt/webapp:ro training/webapp python app.py +$ docker run -d -P --name web -v /src/webapp:/webapp:ro training/webapp python app.py ``` Here you've mounted the same `/src/webapp` directory but you've added the `ro` @@ -186,12 +186,12 @@ the other examples. The following command creates a named volume, called `my-named-volume`, using the `flocker` volume driver, and makes it available within the container -at `/opt/webapp`: +at `/webapp`: ```bash $ docker run -d -P \ --volume-driver=flocker \ - -v my-named-volume:/opt/webapp \ + -v my-named-volume:/webapp \ --name web training/webapp python app.py ``` @@ -205,7 +205,7 @@ using the `docker volume create` command. $ docker volume create -d flocker -o size=20GB my-named-volume $ docker run -d -P \ - -v my-named-volume:/opt/webapp \ + -v my-named-volume:/webapp \ --name web training/webapp python app.py ```