File | Description |
---|---|
Dockerfile |
Docker instructions how to build image. |
app.py |
Python application. |
entrypoint.sh |
Docker instructions how to run the container. |
run.sh |
Bash script to run the application. |
schedule.txt |
Configuration for cron scheduler. |
To launch the app, first build the image, then run the container:
docker build --rm -t python-app .
docker run -t -i --rm --name python-app -v <output-directory>:/output python-app
The <output-directory>
is a directory on the host machine. Use the full, absolute path to specify it. It is used for writing out logs from the application.
The configuration in schedule.txt
will run the Python script every minute. Logs will saved to the <output-directory>
on the host machine and in the /output/
directory inside the container.
To inspect the running container, you can:
- exectute commands inside the container, e.g.
docker exec python-app bash -c "ls -l /app/"
- run the container in interactive mode by commenting out the
ENTRYPOINT
line in theDockerfile
and re-running the steps above