No Django App Created When Following The Docker-compose Tutorial
Solution 1:
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/
Solution 2:
ADD . /code/ in docker file will be actually mount your local working directory inside the docker image. So you can make changes to code inside your working directory and same will be updated inside the docker container as working directory is mounted inside the same.
Use dockerfile as shown in tutorial to generate the image and use the same image for creating container.
Solution 3:
I am hitting the same issue, of the mount /code not showing up. I am using docker (Docker version 1.8.1, build d12ea79) on mac (mac os x yosemite 10.10.5)
Followed for Docker installation: https://docs.docker.com/installation/mac/
Followed for 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
Solution 4:
Had the same issue, and that is because I changed the folder name "/code" in Dockerfile, but forget to change folder name in docker-compose.yum file. So be sure the folder name in the 2 files are the same.
And actually the container(and all the files) is already created in /var/lib/docker/overlay2/.../diff/code/, that is why the log mentioned about "Successfully built ...", but not copied back to the folder where you trigger the cmd. Hope this helps.
Solution 5:
I just had this issue on docker with WSL and tracked it down - it was an issue with volume mounting. Basically to solve this you need to create your project directory in WSL on the mounted c volume on not in a "native" WSL directory. In my case this meant creating my project directory here: /c/Users/seth/proj_dir
You can read more about mounting issues in this excellent WSL/Docker tutorial (search for "Create and modify the new WSL configuration file" and then search again for "docker-compose up": https://nickjanetakis.com/blog/setting-up-docker-for-windows-and-wsl-to-work-flawlessly
Post a Comment for "No Django App Created When Following The Docker-compose Tutorial"