Update README.md

This commit is contained in:
Fred Warren 2021-03-10 11:49:44 -08:00
parent 8a6c2dffd5
commit 18f59d2e04

View File

@ -1,3 +1,47 @@
# Python # Python-3.9 Docker Container
Python-3.9 alpine linux image with added files used by my standard cronjob scripts Python-3.9 alpine linux image with added files used by my standard cronjob scripts. Dummy ssh keys are included. Replace in actual project if needed. This container includes ssh, mysql, read/write xls/xlsx and the pudb python debugger.
This contianer will run the scrpipt named `script.py`.
How install [docker](https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-20-04) and [docker-compose](https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-compose-on-ubuntu-20-04).
## To only Build container
```
docker-compose Build
```
## To Build (if needed) and Run contianer
```
docker-compose up
```
## To Build (if needed) and Run container in background
```
docker-compose up -d
```
## To Run container with command prompt
```
docker-compose run --entrypoint=/bin/sh python-app
```
## To enter running container with command prompt
```
docker-compose exec --entrypoint=/bin/sh python-app
```
## To view container logs
```
docker-compose logs python-app
```
## To monitor container logs (when container started with -d)
```
docker-compose logs -f python-app
```
# Customzing for your own app
Replace the contents of the `app` folder with your python script(s). If the main script is named `script.py` no additonal changes are needed.
If your script has a different name then modify the last line of `docker-compose.yml` and change `entrypoint` to reference your script.