kharandziuk
kharandziuk

Reputation: 12900

Fig volumes don't mount properly

I tried to change project layout in Fig+Django tutorial to something like this:

.
├── docker
│   └── django
│       ├── Dockerfile
│       └── requirements.txt
├── fig.yml
└── project
    ├── figexample
    │   ├── __init__.py
    │   ├── __init__.pyc
    │   ├── settings.py
    │   ├── settings.pyc
    │   ├── urls.py
    │   ├── urls.pyc
    │   ├── wsgi.py
    │   └── wsgi.pyc
    └── manage.py

And my fig.yml looks like:

db:
  image: postgres
web:
  build: ./docker/django
  volumes:
      - "project/:/code"
  ports:
    - "8000:8000"
  links:
    - db
  command: "ls -a ."

But for some reasons instead of project directory it mounts current directory. Result of fig logs in this case will be:

#$ fig logs
Attaching to figdjango_web_1, figdjango_db_1
db_1  | LOG:  database system was shut down at 2014-11-05 15:15:41 UTC
db_1  | LOG:  database system is ready to accept connections
db_1  | LOG:  autovacuum launcher started
web_1 | .
web_1 | ..
web_1 | .fig.yml.swp
web_1 | docker
web_1 | fig.yml
web_1 | project
figdjango_web_1 exited with code 0

And my Dockerfile:

FROM python:2.7
ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
ADD requirements.txt /code/
RUN pip install -r requirements.txt

What I am doing wrong? How I can mount /project to /code?

sample on github

Upvotes: 1

Views: 773

Answers (1)

Thomasleveil
Thomasleveil

Reputation: 104145

The sample you linked to on github is a bit different than what you describe in your question.

In the github sample, replace

command: python /project/manage.py runserver 0.0.0.0:8000

with

command: python /code/manage.py runserver 0.0.0.0:8000`

and it works.

Upvotes: 1

Related Questions