I'm trying to set up a wagtail (a django extension, http://wagtail.io/) site using Docker, and it seems to have worked, but as far as I can tell it has hidden the site away from me somewhere in the bowels of Docker and I can't actually work with it.

My directory is set up like this:

|- docker-compose.yml
|- web
    |- Dockerfile
    |- requirements.txt

My docker-compose.yml

version: '2'
    restart: always
    image: postgres
    build: ./web
    command: python3 manage.py runserver
      - .:/code
      - "8000:8000"
      - db
    restart: always

My Dockerfile:

FROM python:3.5

RUN apt-get update -y


RUN mkdir /code

ADD requirements.txt /code/

RUN pip3 install -r requirements.txt

ADD . /code/

and when I run it...

$docker-compose run web wagtail start site .
Building web
Step 1 : FROM python:3.5
 ---> 64869b3b2083
 ---> Using cache
 ---> 2a539247021e
Step 3 : RUN apt-get update -y
 ---> Using cache
 ---> 6d1094098071
 ---> Using cache
 ---> 12a153c417cd
Step 5 : RUN mkdir /code
 ---> Using cache
 ---> 4cc21041c1c8
Step 6 : WORKDIR /code
 ---> Using cache
 ---> eaca96927442
Step 7 : ADD requirements.txt /code/
 ---> Using cache
 ---> 2f1977d72542
Step 8 : RUN pip3 install -r requirements.txt
 ---> Using cache
 ---> a73e7640aa35
Step 9 : ADD . /code/
 ---> 31bd3c0432cd
Removing intermediate container 66e4fa5b074f
Successfully built 31bd3c0432cd
Creating a wagtail project called site
CommandError: /code/requirements.txt already exists, overlaying a project or app into an existing directory won't replace conflicting files

(The first time I ran it, it "worked" perfectly.)

Where are these mystical files it's created, and how do I clear them out and make it work with a directory I can actually see/edit?

EDIT: This approach is based upon the Django example in Docker's docs (https://docs.docker.com/compose/django/). I've tried that example (using the files verbatim) and I have the same problem:

$ docker-compose run web django-admin.py startproject composeexample .
Creating network "dockerdjangotest_default" with the default driver
Creating dockerdjangotest_db_1
Building web
Step 1 : FROM python:2.7
2.7: Pulling from library/python
efd26ecc9548: Already exists
a3ed95caeb02: Pull complete
d1784d73276e: Already exists
72e581645fc3: Already exists
9709ddcc4d24: Already exists
2d600f0ec235: Already exists
de1491f1bbd4: Pull complete
4becc568d2ff: Pull complete
Digest: sha256:ee46fc8b96ed0d1f1af71d0859ce6ba5f9be3b587f5a608193599b48d0a157c2
Status: Downloaded newer image for python:2.7
 ---> a3b29970a425
 ---> Running in 35a6721182b3
 ---> d8424740fce4
Removing intermediate container 35a6721182b3
Step 3 : RUN mkdir /code
 ---> Running in d1c7e92821ab
 ---> 1c0b1da9e9d3
Removing intermediate container d1c7e92821ab
Step 4 : WORKDIR /code
 ---> Running in 120bb2d0e5dd
 ---> 72725e994f0e
Removing intermediate container 120bb2d0e5dd
Step 5 : ADD requirements.txt /code/
 ---> ef891d60690b
Removing intermediate container 862a5e314f2f
Step 6 : RUN pip install -r requirements.txt
 ---> Running in f51b2bc2ca48
Collecting Django (from -r requirements.txt (line 1))
  Downloading Django-1.9.5-py2.py3-none-any.whl (6.6MB)
Collecting psycopg2 (from -r requirements.txt (line 2))
  Downloading psycopg2-2.6.1.tar.gz (371kB)
Building wheels for collected packages: psycopg2
  Running setup.py bdist_wheel for psycopg2: started
  Running setup.py bdist_wheel for psycopg2: finished with status 'done'
  Stored in directory: /root/.cache/pip/wheels/e2/9a/5e/7b620848bbc7cfb9084aafea077be11618c2b5067bd532f329
Successfully built psycopg2
Installing collected packages: Django, psycopg2
Successfully installed Django-1.9.5 psycopg2-2.6.1
 ---> 349d20d9823e
Removing intermediate container f51b2bc2ca48
Step 7 : ADD . /code/
 ---> 38190d0f4c65
Removing intermediate container 0da1169b5cfa
Successfully built 38190d0f4c65

But no composeexample directory has been created (contrary to what the docs say this directory should now look like):

$ ls -l
total 24
-rw-r--r--  1 user  wheel  146 Apr 17 17:50 Dockerfile
-rw-r--r--  1 user  wheel  209 Apr 17 17:51 docker-compose.yml
-rw-r--r--  1 user  wheel   16 Apr 17 17:50 requirements.txt

But docker still seems convinced everything worked; so those files are... somewhere?

$ docker-compose run web django-admin.py startproject composeexample .
CommandError: /code/manage.py already exists, overlaying a project or app into an existing directory won't replace conflicting files
  • You can use "docker inspect" to view the path to actual location of the volumes and root directory, but you probably wouldn't want to modify these directories directly, as they're managed by docker.
    – Lie Ryan
    Apr 25, 2016 at 6:35

1 Answer 1


To get access to those files you either need:

  • Well, ok, but in principle there's a way to have the documents appear outside of the container, yes? According to the tutorial, it should have put the scaffolded django app in a new folder in the project directory (outside docker), which is what I want, rather than having it accessible only by going into the container. Apr 18, 2016 at 17:17
  • As suggested once you launch container with attached volumes the container can read/write at will Apr 18, 2016 at 19:26
  • The container may be able to, but again, the files aren't accessible outside the container, where the docs suggest they should be. The next line of the tutorial tells me "In your project directory, edit the composeexample/settings.py file." I can't do this, because the previous step that was meant to add those to my project directory, didn't. If I create them myself, it doesn't help, as docker throws an error rather than overwrite the files inside the container with ones from my project directory. Apr 18, 2016 at 22:08
  • Is the volume directive in docker-compose.yml different to the volumes line that I already have in that file? Apr 26, 2016 at 15:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.