[英]`docker run -v` doesn't work as expected
I'm experimenting with a Docker image repository cloned from https://github.com/amouat/example_app.git (which is based on another repository: https://github.com/mrmrcoleman/python_webapp ). 我正在尝试从https://github.com/amouat/example_app.git (基于另一个存储库: https : //github.com/mrmrcoleman/python_webapp )克隆的Docker映像存储库。
The structure of this repository is: 该存储库的结构为:
├── Dockerfile
├── example_app
│ ├── app
│ │ ├── __init__.py
│ │ └── views.py
│ └── __init__.py
├── example_app.wsgi
After building this repository with tag example_app
, I try to mount a directory from the host in the repository: 使用标记
example_app
构建此存储库后,我尝试从存储库中的主机挂载目录:
$ pwd
/Users/satoru/Projects/example_app
$ docker run -v $(pwd):/opt -i -t example_app bash
root@3a12236a1471:/# ls /opt/example_app/
root@3a12236a1471:/# exit
$ ls example_app
__init__.py app run.py
Note that when I tried to list files in /opt/example_app
in the container it turned out to be empty. 请注意,当我尝试在容器的
/opt/example_app
中列出文件时,结果却是空的。
What's wrong in my configuration? 我的配置有什么问题?
Your Dockerfile looks like this: 您的Dockerfile如下所示:
FROM python_webapp
MAINTAINER amouat
ADD example_app.wsgi /var/www/flaskapp/flaskapp.wsgi
CMD service apache2 start && tail -F /var/log/apache2/error.log
So you won't find the files you mentioned since there were non ADD
-d in the Dockerfile. 所以您将找不到您提到的文件,因为Dockerfile中没有非
ADD
-d。 Also, this is not going to work unless python_webapp
installs apache and creates /var/www/flaskapp and /var/log/apache2 exists. 另外,除非
python_webapp
安装apache并创建/ var / www / flaskapp且/ var / log / apache2存在,否则这将无法工作。 Without knowing what these other customs parts do, it is hard to know what to expect. 如果不知道其他海关部门在做什么,很难知道会发生什么。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.