Public | Automated Build

Last pushed: 2 years ago
Short Description
Python on Alpine Linux.
Full Description


A small Python Docker image based on Alpine Linux. The image is only 225 MB and it includes python3-dev.

Supported tags

NOTE: onbuild images install the requirements.txt of your project from the get go. This allows you to cache your requirements right in the build. Make sure you are in the same directory of your requirements.txt file.


The default docker python images are too big, much larger than they need to be. Hence I built this simple image based on docker-alpine, that has everything needed for the most common python projects - including python3-dev (which is not common in most minimal alpine python packages).

REPOSITORY                TAG           VIRTUAL SIZE
jfloff/alpine-python      3.4           225.7 MB
python                    3.4           685.5 MB
python                    3.4-slim      215.1 MB

We actually get the same size as python:3.4-slim but with python3-dev installed (that's around 55MB).

Perhaps this could be even more smaller, but I'm not an Alpine guru. Feel free to post a PR.


This image runs python command on docker run. You can either specify your own command, e.g:

docker run --rm -ti jfloff/alpine-python python

Or extend this images using your custom Dockerfile, e.g:

FROM jfloff/alpine-python:3.4-onbuild

# for a flask server
CMD python runserver

Dont' forget to build your image:

docker build --rm=true -t jfloff/app .

You can also access bash inside the container:

docker run --rm -ti jfloff/alpine-python /bin/bash

Personally, I build an extended Dockerfile version (like shown above), and mount my specific application inside the container:

docker run --rm -v "$(pwd)":/home/app -w /home/app -p 5000:5000 -ti jfloff/app


  • Installs python-dev allowing the use of more advanced packages such as gevent
  • Installs bash allowing interaction with the container
  • Just like the main python docker image, it creates useful symlinks that are expected to exist, e.g. python3.4 > python, pip2.7 > pip, etc.)
  • Added testing repository to Alpine's /etc/apk/repositories file


The code in this repository, unless otherwise noted, is MIT licensed. See the LICENSE file in this repository.

Docker Pull Command
Source Repository