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

**URL:** <https://forums.docker.com/t/need-docker-in-docker-image-w-python-3-x/141181>\
**Category:** Docker Hub\
**Tags:** docker, build\
**Created:** [May 2, 2024, 1:36am UTC](https://forums.docker.com/t/need-docker-in-docker-image-w-python-3-x/141181 "2024-05-02T01:36:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![brookbot](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/brookbot/32/47439_2.png) [@brookbot](https://forums.docker.com/u/brookbot)\
**Post date:** [May 2, 2024, 1:36am UTC](https://forums.docker.com/t/need-docker-in-docker-image-w-python-3-x/141181/1 "2024-05-02T01:36:18Z")

</div>

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?

Thanks

---

<div class="post-metadata">

**Author:** ![brookbot](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/brookbot/32/47439_2.png) [@brookbot](https://forums.docker.com/u/brookbot)\
**Post date:** [May 2, 2024, 11:26pm UTC](https://forums.docker.com/t/need-docker-in-docker-image-w-python-3-x/141181/2 "2024-05-02T23:26:53Z")

</div>

Resolved:

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.

> <https://stackoverflow.com/questions/69246996/how-to-install-python-on-empty-alpine-container>

> <https://stackoverflow.com/questions/63027514/install-package-in-running-docker-container/69481096#69481096>

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`:  
`https://pip.pypa.io/en/stable/installation/`
