<p>Your docker image could be without an OS, that's called <strong>distroless</strong> image.</p>

<p><a href="https://docs.docker.com/develop/develop-images/baseimages/" rel="nofollow noreferrer">https://docs.docker.com/develop/develop-images/baseimages/</a></p>

<p><a href="https://github.com/GoogleContainerTools/distroless" rel="nofollow noreferrer">https://github.com/GoogleContainerTools/distroless</a></p>

CC BY-SA 4.0
2019-11-05T15:54:12.830Z
Do you know if the base python image is this case?
Renan Cunha
CC BY-SA 4.0
2019-11-05T19:52:58.130Z
@RenanCunha : there is many base python images (from your link), they are all OS based images (*buster are Debian based, *alpine are Alpine based...)
sebthebert
CC BY-SA 4.0
2019-11-06T21:54:10.137Z
That's a stretch, first command is installing an OS, and it has to be compatible with your docker host kernel...
Tensibai
CC BY-SA 4.0
2019-11-06T22:05:48.447Z
In brief distroless != osless, you still have an OS, with the basic libraries, you just avoid the "base utilities" (shell, editor, etc.), you still need core libraries like glibc unless your app is totally statically linked (and then you just need to create your image `FROM scratch`)
Tensibai
CC BY-SA 4.0
2019-11-04T23:03:39.323Z
2019-11-04T23:03:39.323Z
sebthebert
<p>By default there is some sort of OS driving almost every container.  If you look at the <a href="https://hub.docker.com/_/python?tab=tags" rel="nofollow noreferrer">tags tab</a> on the docker python image you asked about you can see the OS that the image uses.</p>

<p>Alpine has become a very popular base for docker containers as it is extremely small.  On the <a href="https://hub.docker.com/_/python?tab=tags" rel="nofollow noreferrer">same tags</a> tab compare the 3.5 tagged image at 344.58 MB to the 27.34 MB Alpine image.</p>

CC BY-SA 4.0
2019-11-05T16:52:41.010Z
For example, on the Python 3.6.9 It lists the OSs/ARCHs. This is the OS/ARCH that the container run or that it has?
Renan Cunha
CC BY-SA 4.0
2019-11-05T17:53:13.830Z
@RenanCunha: I don't understand your question.  This is listing the OS/ARCH that the image uses.  You do not need to have that that installed on your system as the OS and all the dependencies are "contained" in the image.  If you remoted into the container this is the OS that you would see.
Wesley Rolnick
CC BY-SA 4.0
2019-11-05T16:16:48.110Z
2019-11-05T16:16:48.110Z
Wesley Rolnick
<p>The python image is based on Debian, Alpine, or Windows Core depending on which tag you select. E.g. if you click on the tag for one of the buster images, you see the Dockerfile with a <code>FROM buildpack-deps:buster</code> entry. Going to that repo on Docker Hub you can track it back to <code>FROM buildpack-deps:buster-scm</code>, then <code>FROM buildpack-deps:buster-curl</code>, and finally <code>FROM debian:buster</code>.</p>

<p>It's important to note that these are not really operating systems, they are Linux distributions that have their filesystems packaged into a container filesystem. You are not managing devices or even running the kernel of that operating system, only using their tools (e.g. <code>apt-get</code>, <code>yum</code>, or <code>apk</code>) to manage the contents of the container.</p>

<p>It is possible to have a container without any Linux distribution as it's base. Every image eventually goes back to <code>FROM scratch</code> which is a meta image name that indicates an empty filesystem. It's the same as the filesystem after <code>rm -rf /</code> or <code>format c:</code>, completely empty, no files, no shell to run, no libraries. If you have a statically linked application without any dependencies on the rest of the filesystem, it's possible to deploy with this in a container since the host Linux kernel is what's actually running the application (docker is just a way to applications on the host with isolation (namespaces) and limits (cgroups) preconfigured). An example of this can be found with the <a href="https://github.com/docker/doodle/blob/master/halloween2019/Dockerfile" rel="nofollow noreferrer">Docker doodles</a>. And building on scratch is Google's distroless images which include various prereqs that many need when running in a container without a distribution included.</p>

CC BY-SA 4.0
2019-11-05T17:34:27.940Z
Do you know if the base python image (EX: Python-3.7) does not have a Linux Distribution?
Renan Cunha
CC BY-SA 4.0
2019-11-05T18:51:46.643Z
@RenanCunha according to the page on Docker Hub, that tag points to `3.7.5-buster` for Linux hosts. You can follow the tags and FROM lines in the Dockerfiles linked by each tag.
BMitch
CC BY-SA 4.0
2019-11-06T22:01:22.713Z
`rm -rf /` and `format c`: are not the same thing, one empty the existing filesystem where the second create a filesystem. a `rmdir /s /q C:` would be a better analogy IMHO. (Never tested trying to format from a windows container, but I assume it would have the same access denied as a fdisk in a linux container trying to modify the host devices)
Tensibai
CC BY-SA 4.0
2019-11-06T22:49:35.857Z
@Tensibai I'm listing commands that many will recognize. These tend to be the most familiar for each respective group.
BMitch
CC BY-SA 4.0
2019-11-06T22:57:15.680Z
Yep, I jus the felt the need to be a bit pedantic :)
Tensibai
CC BY-SA 4.0
2019-11-05T16:55:47.320Z
2019-11-05T16:55:47.320Z
BMitch
<p>Does every container have an OS?</p>

<p>For example, the base <a href="https://hub.docker.com/_/python" rel="nofollow noreferrer">docker python image</a>
has a default OS in it? I couldn't find any info on Google. </p>

<p>I am in doubt because there are some images made with Python that use the Alpine OS.</p>

<docker><containers>
Does every docker container has a a OS?
Renan Cunha
# Does every docker container has a a OS?

(Asked by: username_0 on 2019-11-04)

Does every container have an OS?

For example, the base [docker python image](https://hub.docker.com/_/python)
has a default OS in it? I couldn't find any info on Google.

I am in doubt because there are some images made with Python that use the Alpine OS.

**Tags:** docker, containers


---

## 3 answers

### Answer by username_4 on 2019-11-05. Score: 3 | Accepted answer

The python image is based on Debian, Alpine, or Windows Core depending on which tag you select. E.g. if you click on the tag for one of the buster images, you see the Dockerfile with a `FROM buildpack-deps:buster` entry. Going to that repo on Docker Hub you can track it back to `FROM buildpack-deps:buster-scm`, then `FROM buildpack-deps:buster-curl`, and finally `FROM debian:buster`.

It's important to note that these are not really operating systems, they are Linux distributions that have their filesystems packaged into a container filesystem. You are not managing devices or even running the kernel of that operating system, only using their tools (e.g. `apt-get`, `yum`, or `apk`) to manage the contents of the container.

It is possible to have a container without any Linux distribution as it's base. Every image eventually goes back to `FROM scratch` which is a meta image name that indicates an empty filesystem. It's the same as the filesystem after `rm -rf /` or `format c:`, completely empty, no files, no shell to run, no libraries. If you have a statically linked application without any dependencies on the rest of the filesystem, it's possible to deploy with this in a container since the host Linux kernel is what's actually running the application (docker is just a way to applications on the host with isolation (namespaces) and limits (cgroups) preconfigured). An example of this can be found with the [Docker doodles](https://github.com/docker/doodle/blob/master/halloween2019/Dockerfile). And building on scratch is Google's distroless images which include various prereqs that many need when running in a container without a distribution included.

> **Comments:**
> **username_0**: Do you know if the base python image (EX: Python-3.7) does not have a Linux Distribution?  
> **username_4**: @RenanCunha according to the page on Docker Hub, that tag points to `3.7.5-buster` for Linux hosts. You can follow the tags and FROM lines in the Dockerfiles linked by each tag.  
> **username_2**: `rm -rf /` and `format c`: are not the same thing, one empty the existing filesystem where the second create a filesystem. a `rmdir /s /q C:` would be a better analogy IMHO. (Never tested trying to format from a windows container, but I assume it would have the same access denied as a fdisk in a linux container trying to modify the host devices)  
> **username_4**: @username_2 I'm listing commands that many will recognize. These tend to be the most familiar for each respective group.  
> **username_2**: Yep, I jus the felt the need to be a bit pedantic :)  

---

### Answer by username_1 on 2019-11-04. Score: 2

Your docker image could be without an OS, that's called **distroless** image.

<https://docs.docker.com/develop/develop-images/baseimages/>

<https://github.com/GoogleContainerTools/distroless>

> **Comments:**
> **username_0**: Do you know if the base python image is this case?  
> **username_1**: @RenanCunha : there is many base python images (from your link), they are all OS based images (*buster are Debian based, *alpine are Alpine based...)  
> **username_2**: That's a stretch, first command is installing an OS, and it has to be compatible with your docker host kernel...  
> **username_2**: In brief distroless != osless, you still have an OS, with the basic libraries, you just avoid the "base utilities" (shell, editor, etc.), you still need core libraries like glibc unless your app is totally statically linked (and then you just need to create your image `FROM scratch`)  

---

### Answer by username_3 on 2019-11-05. Score: 0

By default there is some sort of OS driving almost every container. If you look at the [tags tab](https://hub.docker.com/_/python?tab=tags) on the docker python image you asked about you can see the OS that the image uses.

Alpine has become a very popular base for docker containers as it is extremely small. On the [same tags](https://hub.docker.com/_/python?tab=tags) tab compare the 3.5 tagged image at 344.58 MB to the 27.34 MB Alpine image.

> **Comments:**
> **username_0**: For example, on the Python 3.6.9 It lists the OSs/ARCHs. This is the OS/ARCH that the container run or that it has?  
> **username_3**: @RenanCunha: I don't understand your question.  This is listing the OS/ARCH that the image uses.  You do not need to have that that installed on your system as the OS and all the dependencies are "contained" in the image.  If you remoted into the container this is the OS that you would see.  

---

