在docker运行特定的Ubuntu

我想使用特定的Ubuntu版本的docker工人。 我有我的dockerUbuntu的图像为:

ubuntu@ubuntu:~$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE ubuntu latest dd6f76d9cc90 10 days ago 122MB ubuntu 14.04 3aa18c7568fc 10 days ago 188MB 

现在我想用ubuntu 14.04来运行docker:

 ubuntu@ubuntu:~$ docker run -it ubuntu:14.04 root@0b004c5dc55e:/# uname -a Linux 0b004c5dc55e 4.10.0-38-generic #42~16.04.1-Ubuntu SMP Tue Oct 10 16:32:20 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux 

当我用uname -a检查时,我发现还有Ubuntu-16.04。

如何在Docker中运行精确版本的ubuntu?

它似乎运作良好:

  ~/ docker run -it ubuntu:14.04 Unable to find image 'ubuntu:14.04' locally 14.04: Pulling from library/ubuntu bae382666908: Pull complete f1ddd5e846a8: Pull complete 90d12f864ab9: Pull complete a57ea72e3176: Pull complete 783a14252520: Pull complete Digest: sha256:f6eed4def93a3b54da920737f0abf1a8cae2e480bb368280c898265fcaf910a3 Status: Downloaded newer image for ubuntu:14.04 root@d91b2359e1b8:/# uname -a Linux d91b2359e1b8 4.9.44-linuxkit-aufs #1 SMP Fri Aug 25 10:00:41 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux root@d91b2359e1b8:/# cat /etc/*-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=14.04 DISTRIB_CODENAME=trusty DISTRIB_DESCRIPTION="Ubuntu 14.04.5 LTS" NAME="Ubuntu" VERSION="14.04.5 LTS, Trusty Tahr" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 14.04.5 LTS" VERSION_ID="14.04" HOME_URL="http://www.ubuntu.com/" SUPPORT_URL="http://help.ubuntu.com/" BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/" root@d91b2359e1b8:/# 

内核在所有容器之间由主机共享。 要查看运行的版本,请使用: cat /etc/*-release

我认为uname报告内核版本,这是在容器和主机之间共享,并且你的输出是预期的。

你可能想看看这个链接: https : //unix.stackexchange.com/questions/343717/centos7-container-on-centos6-uname-command

你也可以考虑'cat / etc / system-release'