How to install docker specific version

2019-03-08 07:27发布

How to install specific version of Docker(like 1.3.2)?

I am unable to find any documentation in docker official docs. Referring this link for Ubuntu.

Following instructions install docker version 1.0.1: $ sudo apt-get update $ sudo apt-get install docker.io

Also, following instructions install latest version of docker 1.4.1: $ sudo sh -c "echo deb https://get.docker.com/ubuntu docker main > /etc/apt/sources.list.d/docker.list" $ sudo apt-get update $ sudo apt-get install lxc-docker How can I install specific version like 1.3.2?

7条回答
▲ chillily
2楼-- · 2019-03-08 08:04

Got the answer from this github issue comment.

Summary of above commit:-

echo deb http://get.docker.com/ubuntu docker main > /etc/apt/sources.list.d/docker.list

apt-key adv --keyserver pgp.mit.edu --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9

apt-get update
apt-get install -y lxc-docker-1.3.3

If permission issue then use sudo as:

echo deb http://get.docker.com/ubuntu docker main | sudo tee /etc/apt/sources.list.d/docker.list

sudo apt-key adv --keyserver pgp.mit.edu --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9

sudo apt-get update
sudo apt-get install -y lxc-docker-1.3.3

Bonus Tip:

Don't know which version? Then hit Tab after lxc-docker- as:

sudo apt-get install -y lxc-docker-<Hit Tab here>

to see list of available docker versions.

查看更多
Ridiculous、
3楼-- · 2019-03-08 08:04

Another option is to replace install -y lxc-docker in the script with install -y lxc-docker-<version>.

For example, this will install docker 1.6.2:

RUN wget -qO- https://get.docker.com/ubuntu/ | sed -r 's/^apt-get install -y lxc-docker$/apt-get install -y lxc-docker-1.6.2/g' | sh
查看更多
Explosion°爆炸
4楼-- · 2019-03-08 08:04

I got version 1.6.2 years old from source on Ubuntu 16.04. This might not translate to other Docker versions:

  1. git clone https://github.com/moby/moby docker
  2. cd docker
  3. git tag -l -- find your tag of interest in this list (e.g. v1.6.2)
  4. git checkout <tag name>
  5. sudo make build

    Depending on how old your version is, you might see some errors in this step. If you see sample docker images failing to get pulled in, feel free to comment the associated lines out in the Dockerfile. You might see a lvm2 source related failure. Modify the non-existent link to the source specified here. Specifically, in my case, I had to change make Dockerfile refer to the lvm2 source code at git at git://sourceware.org/git/lvm2.git.

  6. sudo make binary
查看更多
乱世女痞
5楼-- · 2019-03-08 08:06
wget -qO- https://get.docker.com/ | sed 's/lxc-docker/lxc-docker-1.6.2/' | sh

Replace 1.6.2 with the version you want.

查看更多
孤傲高冷的网名
6楼-- · 2019-03-08 08:13

I find easier to check available versions with

sudo apt-cache policy docker-engine

and then install the one you want:

sudo  apt-get install docker-engine=1.7.1-0~trusty

It consists on simply following the instructions from docker docs https://docs.docker.com/engine/installation/ubuntulinux/, but selecting a particular version

查看更多
Evening l夕情丶
7楼-- · 2019-03-08 08:17

As Docker Introduces two different flavors (CE and EE) the best and easy way of installing Docker on any system. please run the below command and you do not have to do any thing.

wget -qO- https://get.docker.com/ | sh

if you want to install a specific version of a docker, you can run below command to find what all version of docker is present.

apt-cache madison docker-ce #(for ubuntu)
yum list docker-ce.x86_64  --showduplicates | sort -r #(for centos)

then select the proper version and place it in below command.

wget -qO- https://get.docker.com/ | sed 's/docker-ce/docker-ce=<DOCKER_VERSION/' | sh
查看更多
登录 后发表回答