所以我有一个简单的容器化 django 项目,还有另一个用于 sass css 编译的容器。
我将 docker-compose 与 docker-machine 一起使用,但是当我启动它时,Web 容器中没有我的任何本地文件(manage.py 等),因此它会因file not found: manage.py
错误而死。
让我再解释一下:
docker-compose.yml
web:
build: .
volumes:
- .:/app
ports:
- "8001:5000"
sass:
image: ubuntudesign/sass
command: sass --debug-info --watch /app/static/css -E "UTF-8"
volumes:
- .:/app
Dockerfile
FROM ubuntu:14.04
# Install apt dependencies
RUN apt-get update && apt-get install -y python-dev python-pip git bzr libpq-dev pkg-config
FROM ubuntu:14.04
# Install apt dependencies
RUN apt-get update && apt-get install -y python-dev python-pip git bzr libpq-dev pkg-config
# Pip requirements files
COPY requirements /requirements
# Install pip requirements
RUN pip install -r /requirements/dev.txt
COPY . /app
WORKDIR /app
CMD ["python", "manage.py", "runserver", "0.0.0.0:5000"]
以及本地目录中的标准 django 项目:
$ ls
docker-compose.yml Dockerfile manage.py README.md static templates webapp
这是我可以做到的孤立错误:
$ docker-compose run web python
can't open file 'manage.py': [Errno 2] No such file or directory
这是真的:
$ docker-compose run web ls
static
我认为这是使用 remotedocker-machine
的问题,我尝试遵循简单的 django 教程,并且我认为本地文件共享的工作方式不同。
使用 docker-machine 有什么不同?