How to install the latest version of Docker on Cen

2019-02-26 21:47发布

问题:

I am trying to have a modern docker.io version 1.5+ installed on a CentOS 7 64bit system.

The default docker.io that comes with the yum servers is 1.3.2, and this version is too old for some of the docker.io features I need, e.g.

(install local docker registry on centos 7)

Details of the system:

docker --version
Docker version 1.3.2, build 39fa2fa/1.3.2

System:

cat /etc/centos-release
CentOS Linux release 7.0.1406 (Core)

uname -a
Linux hostname 3.10.0-123.20.1.el7.x86_64 #1 SMP Thu Jan 29 18:05:33 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Any ideas how to install a modern docker.io 1.5+?

回答1:

Here is what I did:

  1. Add a repo to yum using this command

sudo vi /etc/yum.repos.d/cbs.repo

and with this contents:

[virt7-testing]
name=virt7-testing
baseurl=http://cbs.centos.org/repos/virt7-testing/x86_64/os/
enabled=1
gpgcheck=0
  1. Start yum using Applications -> System Tools -> Software

  2. Search for Docker

  3. Note that docker 1.5.x is available for install.

  4. If Docker 1.3.2 is installed, uninstall it by unchecking it and clicking apply.

  5. Click the check box next to Docker 1.5.x and click apply.

  6. Test that the install was successful by running docker --version from command line.


回答2:

Please see the official user guide on installing the latest version of Docker on CentOS

At the very start it says: "While using a package is the recommended way of installing Docker, the above package might not be the current release version. If you need the latest version, you can install the binary directly."

This tells you how to do that: https://docs.docker.com/installation/binaries/

Basically:

  • check your dependencies
  • download the binary: wget https://get.docker.com/builds/Linux/x86_64/docker-latest -O docker
  • run the daemon: sudo ./docker -d &

Now you're good to go.