Can I install the 12.04 distribution in a docker container hosted by a 16.04 distribution

6,270

There is no need to install the image from scratch, I found this answer where you can make docker to download the desired version and I adapted to my needs:

sudo docker run ubuntu:12.04 cat /etc/issue

returns this:

Unable to find image 'ubuntu:12.04' locally
12.04: Pulling from library/ubuntu
Downloading
...
Status: Downloaded newer image for ubuntu:12.04
Ubuntu 12.04.4 LTS \n \l

or alternatively you can use:

sudo docker pull ubuntu:12.04

and then run that image with

sudo docker run -i -t ubuntu:12.04 /bin/bash

to make sure in the prompt try to see the version:

cat /etc/issue

PS. Dont forget to commit the changes, before exiting, otherwise are lost. First get the container id using this command:

sudo docker ps -l

Commit changes to the container:

sudo docker commit <container_id> repo/img1 

Then run the container:

sudo docker run -i -t repo/img1 /bin/bash
Share:
6,270

Related videos on Youtube

Eduard Florinescu
Author by

Eduard Florinescu

Coding my way out of boredom. “If the fool would persist in his folly he would become wise.” (William Blake)

Updated on September 18, 2022

Comments

  • Eduard Florinescu
    Eduard Florinescu over 1 year

    I have a docker container hosted by 16.04 can I install a 12.04 distribution into this container?