1

I am just slowly getting into Docker. I want to create an Ubuntu 16.04 image. I know that docker run -it ubuntu creates an ubuntu image but when I do that, I get 20.04

1 Answer 1

4

I wouldn't suggest making a 16.04 image since that was EOL as of April 2021. You can search the docker hub for "ubuntu 16.04" and find several instances of it

$ docker pull ubuntu:16.04

Trying to pull repository docker.io/library/ubuntu ...
16.04: Pulling from docker.io/library/ubuntu
58690f9b18fc: Pull complete
b51569e7c507: Pull complete
da8ef40b9eca: Pull complete
fb15d46c38dc: Pull complete
Digest: sha256:0f71fa8d4d2d4292c3c617fda2b36f6dabe5c8b6e34c3dc5b0d17d4e704bd39c
Status: Downloaded newer image for docker.io/ubuntu:16.04

and then run it with:

$ docker run -it --rm ubuntu:16.04 /bin/bash
root@b912d2c0db04:/# cat /etc/os-release
NAME="Ubuntu"
VERSION="16.04.7 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.7 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial

and you can use FROM ubuntu:16.04 in your docker files to reference it.

The 16.04 after the colon in the name identifies which version you're pulling down, if you don't specify it, there's some convention that defaults to latest, which would be 20.04, until sometime in April 2022.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.