Detailed installation Docker official

# 0x00 install warm-up

- for the CE version

Docker into CE and EE versions, CE free, EE fees, CE version and the ability to meet all of our needs

This paper version of the installation instructions for CE

- systems Manual

In this paper, CentOS 7 an example for installation, and do not use CentOS Archived version 7 beta, because they do not support

- Source Description

CentOS is extended source (centos-extras) must be enabled, it is enabled by default, but if you had closed it before, you need to re-enable it

Overlay2 recommended storage engine

- remove the old version of Docker

The default yum install docker or docker-engine version for a long time, we first uninstall

$ sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine

Note: / var / lib / docker / container below, mirror, network, disk volumes are retained

The new docker docker-ce changed is the free version docker

 

# 0x01 begin the installation

There are three methods of installation:

1. Set the network source, then yum install, to facilitate future maintenance and upgrades (recommended)

2. Download the RPM package manually install and upgrade, if there is no network this method is very practical

3. Use automated scripts to install, suitable for use in development and test environments

 

- use yum install

Before starting the installation you need to set it Docker source, directly through the source behind the installation and upgrade

1. Install yum-utils, yum-config-manager, devicemapper-persistent-data lvm2 (devicemapper storage engine is dependent)

$ sudo yum install -y yum-utils \
  device-mapper-persistent-data \
  lvm2

 

2. Set official source docker-ce.repo

$ sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo

 

2.5 The following several optional steps

The default is the stable version, if the first try nighty or test can use the following command to turn on or off

Enabling nightly version  

$ sudo yum-config-manager --enable docker-ce-nightly

 

Enable test version

$ sudo yum-config-manager --enable docker-ce-test

 

Disable nightly

$ sudo yum-config-manager --disable docker-ce-nightly

 

3. Start the installation

3.1 so much nonsense, this step is the key, the default installation is up to date, or use the following step to install the specified version

 sudo  yum  install docker docker it is containerd.io-cli

There may be prompted 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35 key matches

And if, like here, you can choose to accept. Note that the latest version can be unstable

Docker This installed, but not enabled by default creates a docker groups, but not users in this group

 

3.2 assign specific version of the docker installation

A. You can use the following command to list all docker version can be installed from the source, the sort high to low and

$ yum list docker-ce --showduplicates | sort -r

docker-ce.x86_64  3:18.09.1-3.el7                     docker-ce-stable
docker-ce.x86_64  3:18.09.0-3.el7                     docker-ce-stable
docker-ce.x86_64  18.06.1.ce-3.el7                    docker-ce-stable
docker-ce.x86_64  18.06.0.ce-3.el7                    docker-ce-stable

Everyone can see the list may be different, depending on your library enabled, and your specific version of CentOS

 

B. select a specific version for installation

Selection method is to use - be convergence version you want to see in the following format

$ sudo yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io

 

For example, here I installed the version 18.09.5

$ Sudo  yum  install docker-this- 18.09 . 5 docker it-cli- 18.09 . 5 containerd.io

Like perform just finished installing a docker not enabled, create a temporary group of non-users docker

 

4. Start docker

$ sudo systemctl start docker

 

5. Verify that the client can use, test hello-world image

$ sudo docker run hello-world

From this step will docker-hub (similar GitHub) pull to above hello-world image, this image is then created and run by the container

Print a hello world to quit, but also can be used on behalf of docker-cli

 

 

- Using RPM installation (not recommended)

If your computer does not have linux network (what year? No network?), Can be downloaded RPM package into a manual installation on CentOS

1. Download the RPM package

And want to upgrade, then also you need to go online to download the latest installation package

Download URL  https://download.docker.com/linux/centos/7/x86_64/stable/Packages/

If you do not know how to pick, you can refer to the following three packages download

docker-ce-cli-18.09.5-3.el7.x86_64.rpm

docker-ce-18.09.5-3.el7.x86_64.rpm

containerd.io-1.2.5-3.1.el7.x86_64.rpm

If you want to try nighty like to toss as long as the URL in the stable into nighty on the line

 

2. Install the RPM package

$ sudo yum install /path/to/package.rpm

docker group perform just finished installing a docker not enabled, the user did not create a temporary

 

3. Start docker

$ sudo systemctl start docker

 

4. Verify that the client can use, test hello-world image

$ sudo docker run hello-world

From this step will docker-hub (similar GitHub) pull to above hello-world image, this image is then created and run by the container

Print a hello world to quit, but also can be used on behalf of docker-cli

 

5. Upgrade

Remember that want to upgrade to be back online first step to re-download the latest installation package, follow the steps to go, then

$ sudo yum update /path/to/package.rpm

 

 

- Use a key deployment script installation

Official provides one-click deployment scripts   get.docker.com  and  test.docker.com 

We get recommended at the beginning, and in this way to avoid interaction is suitable for novice, this is the docker-install the source  docker-install Repository .

In a production environment, it is not recommended to use these scripts, you need to understand the risks involved (it plainly do not look for trouble I), the risk is as follows:

  • The scripts require root or sudo privileges to run. Therefore, you should carefully examine and audit the scripts before running them.
  • The scripts attempt to detect your Linux distribution and version and configure your package management system for you. In addition, the scripts do not allow you to customize any installation parameters. This may lead to an unsupported configuration, either from Docker’s point of view or from your own organization’s guidelines and standards.
  • The scripts install all dependencies and recommendations of the package manager without asking for confirmation. This may install a large number of packages, depending on the current configuration of your host machine.
  • The script does not provide options to specify which version of Docker to install, and installs the latest version that is released in the “edge” channel.
  • Do not use the convenience script if Docker has already been installed on the host machine using another mechanism.

1. The script needs to be run as root, you seriously better audit the code, or delete library on foot do not know

2. The script attempts to detect the version of your system and change the related configuration, in addition to not add a custom installation parameters may lead to poor configuration support, even words into Japanese, so you can not read. . . .

3. script without the brain depend on all recommended and installed a whole, not after your confirmation, leading to a large number of packages, depending on your system configuration

4. The script does not give you choose which specific version, you turn directly to the latest

5. If you have security over docker, and if you use the script and installed once, then congratulations, cool, and quickly tidy up that what it

 

FBI Warning:

Check the code before running the script, because the script on the server is likely to hackers replaced

 

See here still wants to look at it, then come on

$ curl -fsSL https://get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh

<output truncated>

 

 If you want to use the non-root user, execute the following command

  sudo usermod -aG docker your-user

Remember to exit and re-login to take effect

 

- Uninstall Docker

Here you docker should be installed by one of the foregoing three ways, you need to manually start it, or using the service command systemctl

Made it clear beforehand, by default, non-root is not running docker command, the following is a method to uninstall

1. Stop docker

$ sudo systemctl stop docker

2. Uninstall Package

$ sudo yum remove docker-ce

3. Delete resources (container volume mirrored network map)

$ sudo rm -rf /var/lib/docker

 

 

Guess you like

Origin www.cnblogs.com/demonxian3/p/10990723.html