How to install docker specific version

。_饼干妹妹 提交于 2019-12-03 02:20:36

问题


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?


回答1:


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




回答2:


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.




回答3:


How I did it on my laptop (btw https://get.docker.com/ubuntu/ not available anymore):

$ wget -qO- https://get.docker.com/ | sh      # install resources
$ apt-cache showpkg docker-engine             # show version which are available
$ apt-get install docker-engine=1.8.2-0~willy # install 1.8.2 version
$ sudo apt-mark hold docker-engine            # prevent upgrade on sys upgrade
$ docker version                              # check installed docker version



回答4:


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



回答5:


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:


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



回答7:


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


来源:https://stackoverflow.com/questions/27657888/how-to-install-docker-specific-version

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!