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.
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.
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.
I will try that but then there is an explicit call to the docker entry point in docker_compose.yml file. Is this something that is not related?
@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:
The error message you’re seeing now should go away, though you may get a new message once it runs.
What’s in the Dockerfile? You specified a build in your docker-compose.yml file but did not display the Dockerfile.