No django app generated when doing docker compose tutorial

I am following a docker tutorial to try and figure out how to get my django app to deploy: http://docs.docker.com/compose/django/

And everything goes smoothly (the app even works!), But the django project folder is composeexample

not created in my local project directory.

I have left to work "It works!". after running:

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

But I can't continue editing composeexample/settings.py

as the tutorial suggests: the folder doesn't exist on my machine (it does exist in the container, but I don't feel good about that!)

Is the tutorial wrong? Didn't I follow him correctly?

Thank!

UPDATE:

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

+3


source to share


3 answers


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

Copy files from host to Docker container



Example:

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

      

+1


source


ADD. / Code / in docker will actually mount the local working directory inside the docker image. This way you can make changes to the code inside your working directory and the same will update inside the docker container as the working directory will be set inside the same.



Use a docker file as shown in the tutorial to create an image and use the same image to create a container.

0


source


I am facing the same problem that mount / code is not showing. I am using docker (Docker version 1.8.1, build d12ea79) on mac (mac os x yosemite 10.10.5)

Next to install Docker: https://docs.docker.com/installation/mac/

Further for the Django part: https://docs.docker.com/compose/django/

f$ docker-compose run web django-admin.py startproject composeexample .
    ...........
    ... Removing details for brevity ...
    ...........
Removing intermediate container 515d53d20d29
Step 6 : ADD . /code/
 ---> ea2b28ba6ebc
Removing intermediate container 6d6f0f9e2fe0
Successfully built ea2b28ba6ebc

f$ ls
Dockerfile   docker-compose.yml   requirements.txt

      

0


source







All Articles