Docker problem!

I first played with docker in 2016. And created my 1st container in 2018. Very basic stuff and no claim to great Docker understanding. Because if I had a better understanding I’m sure I would have used it more. Anywho, started a Linux Academy course called Docker Quick Start. This 2hr course has so far taken me a few days, because of other things I’m working on and because I got sidetracked (as I often do) trying to apply Docker into potential future personal projects…so much for quick start. This isn’t a knock against the course, because if you take it using their cloud server it probably would fall somewhere in that time frame.

I could easily envision using Docker with Python. So I attempted to do one of the early exercises on my personal Linux distribution. Without going into every detail, it was necessary to install python3 into a container running Ubuntu 16.04. In the lecture you did this within the dockerfile using the commands

RUN apt-get update
RUN apt-get -y install python3

However running this on my Docker returns “E: Unable to locate package python3”

How can this be…I ask in my early days of docker usage?
At first I started googling for solutions to this problem. And I would see answers such as make sure you apt-get update first which of course I did. I also saw references to your etc/apt/sources.list file.

Then I realized why am I searching for an answer. I’m using the exact same dockerfile as in the lecture. Easy to double check because it’s only 4 lines. What follows is my assumptions of Docker. I’m pulling the exact same Ubuntu 16.04 image, from Docker Hub, used successfully in the lecture. So in theory it should have the exact same sources.list file. In fact everything should be exactly the same.

Isn’t this Dockers main claim to fame…containing the exact environment for everyone?

Ultimately I updated my backup distro…Manjaro to the latest version, then installed docker there. Which by the way was very easy in Manjaro. And it successfully ran the same exact dockerfile installing Python3 without any problems!

I should point out that my unsuccessful docker run used version 18.09.7, build 2d0083d and my successful Manjaro docker run used version 19.03.5, build 633a0ea. As of today, Linux Academy’s Cloud server also uses Docker version 19.03.5, build 633a0ea. However this wasn’t some weird, obscure command, it was apt-get install, which I assume many other people have successfully used on this older docker version.

So what am I not understanding about the containment aspect of Docker?

Perhaps docker should provide a more comprehensive tests than they do in their hello-world docker image program which tells me (on my older version) This message shows that your installation appears to be working correctly. Because it obviously doesn’t!