Need docker-in-docker image w/Python 3.x

Hi, docker newbie here…

I need a docker-in-docker container that we can use in our gitlab CI jobs to build a docker image using a python script. We currently use docker:stable, but it is a bare-minimum container w/only sh (not even bash). It does not even have apt-get so I’m at a loss for how to install/add python.

How can I build a new docker image based on docker:stable w/Python

Basically our needs are Python 3.5+, docker build, docker login and docker push

Also - is there a convenient link that will show me what docker-in-docker images are available, and what the name of the stable image is so that we can start using a specific version instead of “stable” to avoid breakage when stable increments to the next major release?



Turns out docker:stable is just busybox + docker. apt-get is not there (perhaps because busybox is Alpine based?) so need to use apk instead.

Better to create a dockerfile use docker build and manage in git than to just create an image interactively once you have figured it out tho.

This was useful and worked as well ensurepip: