Docker images for Python applications and services. Supports multiple Python versions (3.7-3.11) with build tools and common data science/web frameworks.
3.7/Dockerfile- Python 3.7 with development tools3.8/Dockerfile- Python 3.8 with development tools3.9/Dockerfile- Python 3.9 with development toolsentrypoint.sh- Container entrypoint with STARTUP variable supportREADME.md- This file
docker run -it \
-e STARTUP="python app.py" \
ghcr.io/nodebytehosting/python:python_3.9version: '3.8'
services:
python-app:
image: ghcr.io/nodebytehosting/python:python_3.9
environment:
STARTUP: "python app.py"
PYTHONUNBUFFERED: "1"
volumes:
- ./app:/home/container
restart: unless-stoppeddocker build -t python:3.9 python/3.9/
docker run -it -e STARTUP="python app.py" python:3.9| Variable | Default | Description |
|---|---|---|
STARTUP |
- | Python command to execute (required) |
TZ |
UTC | Timezone (e.g., America/New_York) |
PYTHONUNBUFFERED |
- | Set to 1 for unbuffered output |
PYTHONDONTWRITEBYTECODE |
- | Set to 1 to skip .pyc generation |
INTERNAL_IP |
auto | Internal container IP (auto-detected) |
USER |
container | Container user (read-only) |
HOME |
/home/container | Container home directory (read-only) |
The entrypoint supports Pterodactyl-style variable substitution:
# Input
STARTUP="python app.py --port {{SERVER_PORT}} --bind {{INTERNAL_IP}}"
# Output
STARTUP="python app.py --port 8080 --bind 172.17.0.2"pip- Python package managercmake- Build system for C extensionsgcc,g++,make- C/C++ compilation supportgit- Clone repositoriescurl- HTTP/HTTPS downloadswget- Alternative downloaderca-certificates- Certificate authorities
docker run -it \
-e STARTUP="python -m flask run --host=0.0.0.0" \
-e PYTHONUNBUFFERED=1 \
-p 5000:5000/tcp \
-v ./app:/home/container \
ghcr.io/nodebytehosting/python:python_3.9docker run -it \
-e STARTUP="python manage.py runserver 0.0.0.0:8000" \
-e PYTHONUNBUFFERED=1 \
-p 8000:8000/tcp \
-v ./app:/home/container \
ghcr.io/nodebytehosting/python:python_3.9docker run -it \
-e STARTUP="python -m uvicorn main:app --host 0.0.0.0 --port 8000" \
-e PYTHONUNBUFFERED=1 \
-p 8000:8000/tcp \
-v ./app:/home/container \
ghcr.io/nodebytehosting/python:python_3.9docker run -it \
-e STARTUP="python data_processor.py --input data.csv" \
-v ./data:/home/container/data \
-v ./output:/home/container/output \
ghcr.io/nodebytehosting/python:python_3.9FROM ghcr.io/nodebytehosting/python:python_3.9
COPY requirements.txt /home/container/
RUN pip install --no-cache-dir -r /home/container/requirements.txt
COPY . /home/container/| Version | Release Date | EOL Date |
|---|---|---|
| 3.7 | June 2018 | June 2023 |
| 3.8 | October 2019 | October 2024 |
| 3.9 | October 2020 | October 2025 |
| 3.10 | October 2021 | October 2026 |
| 3.11 | October 2022 | October 2027 |
- Base: Alpine 3.20
- Platform: linux/amd64, linux/arm64 (multiarch)
- pip: Latest version for each Python version
To add support for additional Python versions, create new directories:
mkdir -p python/3.10 python/3.11Update each Dockerfile to use the desired Python base:
FROM python:3.11-alpine3.20
# ... rest of DockerfileThen add versions to the GitHub Actions workflow matrix:
matrix:
tag:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"Python virtual environments work in containers, but are less necessary:
# Not recommended - takes extra space
docker run -it ghcr.io/nodebytehosting/python:python_3.9 \
bash -c "python -m venv /venv && source /venv/bin/activate && python app.py"
# Better - install directly
docker run -it ghcr.io/nodebytehosting/python:python_3.9 \
bash -c "pip install -r requirements.txt && python app.py"- Use
PYTHONUNBUFFERED=1- Ensures real-time output - Use
PYTHONDONTWRITEBYTECODE=1- Saves disk space in containers - Install only production deps -
pip install -r requirements.txt --no-dev - Use Alpine's wheels - Pre-compiled packages for faster installation
- Multi-stage builds - Reduce final image size
- Check
STARTUPvariable is set - Run
python --versionto verify Python is available - Check application logs for errors
- Install build dependencies:
gcc,make,python3-dev - Use
pip install --no-cache-dirto ensure fresh download - Check for platform-specific wheel compatibility
- Monitor with
free -mandps aux - Limit pip workers:
pip install --no-cache-dir -r requirements.txt - Use
sys.getsizeof()to profile memory usage
- Use
--no-cache-dirto skip download cache - Pre-compile wheels if installing frequently
- Use Alpine binary wheels when available
MIT License - See LICENSE file for details
- Issues: https://github.com/NodeByteHosting/game-recipes/issues
- Discord: https://discord.gg/Bg3Sf5fqa4
- Python Docs: https://docs.python.org/
- PyPI: https://pypi.org/