Search code examples
pythondjangodockerdocker-composedocker-machine

no django app created when following the docker-compose tutorial


I'm following the docker-compose tutorial, to try and figure out how to get a django app to deploy: http://docs.docker.com/compose/django/

And everything's going smoothly (the app even works!) but the django project folder composeexample isn't created in my local project directory.

I'm left with a working "It Works!" page after running:

$ docker-compose run web django-admin.py startproject composeexample .

But I can't continue to edit the composeexample/settings.py, as the tutorial suggests: The folder doesn't exist on my machine (it does exist in the container, but it's no good to me there!)

Is the tutorial wrong? Did I not follow it right?

Thanks!

UPDATE:

Here's the problem, I'm using docker-machine to run this whole process through a remote docker instance. Are the rules about local folder sharing different when using a remote docker machine?


Solution

  • You need to set up a dockerfile so that when you do a docker build, it copies your local code onto the container. To get started, you will need to copy the files from container to local. Look here for that. Or just overwrite the directory with your own django app

    Copying files from host to Docker container

    example:

    FROM python:2.7
    RUN mkdir /code
    WORKDIR /code
    ADD . /code/