Home

Awesome

Python Docker Container Images

Build Status Docker Pulls Docker Stars

Table of Contents

Docker Images

❗For better reliability we release images with stability tags (wodby/python:3-X.X.X) which correspond to git tags. We strongly recommend using images only with stability tags.

About images:

Supported tags and respective Dockerfile links:

-dev

Images with -dev tag have sudo allowed for all commands for wodby user.

-dev-macos

Same as -dev but the default user/group wodby has uid/gid 501/20 to match the macOS default user/group ids.

Supported architectures

All images built for linux/amd64, -dev-macos images additionally built for linux/arm64

Environment Variables

VariableDefault value
GIT_USER_EMAILwodby@example.com
GIT_USER_NAMEwodby
GUNICORN_APPmyapp.wsgi:application
GUNICORN_BACKLOG2048
GUNICORN_KEEPALIVE2
GUNICORN_LOGLEVELinfo
GUNICORN_PROC_NAMEGunicorn
GUNICORN_PYTHONPATH
GUNICORN_SPEWFalse
GUNICORN_TIMEOUT30
GUNICORN_WORKER_CLASSsync
GUNICORN_WORKER_CONNECTIONS1000
GUNICORN_WORKERS4
SSH_DISABLE_STRICT_KEY_CHECKING
SSH_PRIVATE_KEY
SSHD_GATEWAY_PORTSno
SSHD_HOST_KEYS_DIR/etc/ssh
SSHD_LOG_LEVELINFO
SSHD_PASSWORD_AUTHENTICATIONno
SSHD_PERMIT_USER_ENVno
SSHD_USE_DNSyes

Build arguments

ArgumentDefault value
PYTHON_DEV
PYTHON_DEBUG
WODBY_GROUP_ID1000
WODBY_USER_ID1000

Change WODBY_USER_ID and WODBY_GROUP_ID mainly for local dev version of images, if it matches with existing system user/group ids the latter will be deleted.

Changelog

Changes per stability tag reflected in git tags description under releases.

Crond

You can run Crond with this image changing the command to sudo -E crond -f -d 0 and mounting a crontab file to ./crontab:/etc/crontabs/www-data. Example crontab file contents:

# min	hour	day	month	weekday	command
*/1	*	*	*	*	echo "test" > /mnt/files/cron

SSHD

You can run SSHD with this image by changing the command to sudo /usr/sbin/sshd -De and mounting authorized public keys to /home/wodby/.ssh/authorized_keys

Adding SSH key

You can add a private SSH key to the container by mounting it to /home/wodby/.ssh/id_rsa

Users and permissions

Default container user is wodby:wodby (UID/GID 1000). Gunicorn runs from www-data:www-data user (UID/GID 82) by default. User wodby is a part of www-data group.

Codebase volume $APP_ROOT (/usr/src/app) owned by wodby:wodby. Files volume $FILES_DIR (/mnt/files) owned by www-data:www-data with 775 mode.

Helper scripts

Complete Python stack

See https://github.com/wodby/docker4python

Orchestration Actions

Usage:

make COMMAND [params ...]

commands:
    migrate
    check-ready [host max_try wait_seconds delay_seconds]
    files-import source
    files-link public_dir