Issues with Volume in Docker - Compose Fail to install Django App.

I am trying to install an application from github to my droplet and the Docker-compose.yml file includes mapping volumes.

The github location for the app is which has the following instruction to set up the up using the docker console.

$ cp .env.sample .env
$ docker-compose build
$ docker-compose run app python migrate
$ docker-compose run app python loaddata test_data/data-update.json

The thing works perfectly on the local machine and I was able to get it working in the local docker installation. Here is a link I am using to

build: .
- ./tock:/tock
- db
working_dir: /tock
entrypoint: python /tock/
- DATABASE_URL=postgres://tock_user@db/tock
command: "python runserver${EXTERNAL_PORT}"

However when I run the docker-compose run app python migrate statement, it says that the /tock/ file not found.

python: can't open file '/tock/': [Errno 2] No such file or directory

Google results indicate that the mount of the volume is not working and I am trying to find out how to confirm that the volume is being mounted.

On running docker volume ls I am seeing a bunch of volumes but the names are not consistent.

Also when I look at the volumes section I see that the Name of the volume is not tock but some random guid.

docker volume inspect e32d8cdf9a61015bc4230781878c715ef56cf6c47536e17c75721c6a47455204
        "Name": "e32d8cdf9a61015bc4230781878c715ef56cf6c47536e17c75721c6a47455204",
        "Driver": "local",
        "Mountpoint": "/var/lib/docker/volumes/e32d8cdf9a61015bc4230781878c715ef56cf6c47536e17c75721c6a47455204/_data",
        "Labels": null

I am a newbie and have been trying to get this working but with no luck as the mount does not work.

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

This question was answered by @gndo:

@vinitpatankar - I believe the image is using the default CMD, which is to run in the current WORKDIR. To test this, add this to the end of your Dockerfile:

# Override test of default command to port 9876
CMD  ["python", "", "runserver", ""]

The error message you’re seeing now should go away, though you may get a new message once it runs.

View the original comment