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 www.github.com/18f/tock 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 manage.py migrate
$ docker-compose run app python manage.py 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 https://realpython.com/blog/python/django-development-with-docker-compose-and-machine/
app:
build: .
volumes:
- ./tock:/tock
links:
- db
working_dir: /tock
entrypoint: python /tock/docker_entrypoint.py
environment:
- PYTHONUNBUFFERED=yup
- DATABASE_URL=postgres://tock_user@db/tock
- RUNNING_IN_DOCKER=yup
- DJANGO_SETTINGS_MODULE=tock.settings.dev
command: "python manage.py runserver 0.0.0.0:${EXTERNAL_PORT}"
However when I run the docker-compose run app python manage.py migrate statement, it says that the /tock/docker_entrypoint.py file not found.
python: can't open file '/tock/docker_entrypoint.py': [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.
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!
This question was answered by @gndo:
@vinitpatankar - I believe the image is using the default CMD, which is to run docker_entrypoint.py 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", "manage.py", "runserver", "0.0.0.0:9876"]The error message you’re seeing now should go away, though you may get a new message once it runs.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.