Installing Docker on Linux

Source: Internet
Author: User
Tags gpg

Three core concepts of Docker: mirrors, containers, warehouses

Image: Like a virtual machine image, as the saying goes is the installation file.

Containers: Similar to a lightweight sandbox, where containers are created from images to run instances of the application,

You can start, start, stop, delete, and these containers are isolated from each other and are not visible to each other.

Warehouses: Similar to a code warehouse, a place where Docker centrally stores image files.

A quick introduction to installing Docker on CentOS.

Pre-conditions:

64-bit system

Kernel 3.10+

1. Check the kernel version and return a value greater than 3.10.

$ uname-r

2. Log in to the terminal using sudo or root privileges.

3. Make sure Yum is up to date

$ yum Update

4. Add a yum repository

< <- ' EOF '  [Dockerrepo]  NameRepository  baseurl=https://yum.dockerproject.org/repo/main/centos/$ releasever/  enabled=1  gpgcheck=1  Gpgkey  =https://yum.dockerproject.org/gpg  EOF  

5. Installing Docker

$ yum install-y docker-engine

After the installation is successful, use the Docker version command to see if the installation was successful, after the installation------as

6. Start Docker

$systemctl Start Docker.service

7. Verify that the installation was successful (with both client and service sections indicating that the Docker installation started successfully)

Use the Docker version command to view

8. Set up boot from boot

$ sudo systemctl enable Docker

So far, Docker is fully installed.

Found Docker boot not, check the following error:

[Email protected] ~]# Systemctl restart DockerJob for Docker.service failed because the control process exited with error code. See "Systemctl Status Docker.service" and "Journalctl-xe" for details.[[email protected] ~]# systemctl status Docker docker.service-docker application Container Engine loaded:loaded   (/usr/lib/systemd/system/docker.service; disabled; vendor preset:disabled) Active:failed (Result:exit-code) since Mon 2017-07-03 10:12:16 CST; 5s ago docs:http://docs.docker.com process:16172 execstart=/usr/bin/dockerd-current--add-runtime docker-runc=/usr/ Libexec/docker/docker-runc-current--default-runtime=docker-runc--exec-opt Native.cgroupdriver=systemd-- Userland-proxy-path=/usr/libexec/docker/docker-proxy-current $OPTIONS $DOCKER _storage_options $DOCKER _network_ OPTIONS $ADD _registry $BLOCK _registry $INSECURE _registry (code=exited, status=1/failure) Main pid:16172 (code=exited, status=1/failure) Jul 10:12:15 aly-hkc-pro-001 systemd[1]: Starting Docker application Container Engine ... Jul 10:12:15 aly-hkc-pro-001 dockerd-current[16172]: time= "2017-07-03t10:12:15.812330534+08:00" Level=info msg= " Libcontainerd:new Containerd Process, pid:16180"Jul 10:12:16 aly-hkc-pro-001 dockerd-current[16172]: time=" 2017-07-03t10:12:16.823237678+08:00 "level=warning msg = "Devmapper:usage of loopback devices is strongly discourage...v section." Jul 10:12:16 aly-hkc-pro-001 dockerd-current[16172]: time= "2017-07-03t10:12:16.838204058+08:00" Level=error msg= "[ Graphdriver] Prior storage driver \ "Devicemapper\" Failed:d...run failed "Jul 10:12:16 aly-hkc-pro-001 dockerd-current [16172]: Time= "2017-07-03t10:12:16.838278116+08:00" Level=fatal msg= "Error starting Daemon:error initializing Graphdriver:devmap...run failed "Jul 10:12:16 aly-hkc-pro-001 systemd[1]: Docker.service:main process exited, Code=ex ited, Status=1/failurejul 10:12:16 aly-hkc-pro-001 systemd[1]: Failed to start Docker application Container Engine.jul 10:12:16 aly-hkc-pro-001 systemd[1]: Unit Docker.service entered failed state. Jul 10:12:16 aly-hkc-pro-001 systemd[1]: Docker.service failed. Hint:some lines were ellipsized, use-l to show on full.

We can see here that it hints at failed to start Docker application Container Engine.

So on the internet to find a variety of similar errors, there is a need to put Firewalld.service and SELinux closed. Well, this is going to cause Docker to fail, but this is not the reason for the blogger.

Bo Master the first time can think of only re-install Docker, can be repeatedly deleted after a few times still to solve the problem. (during the period thought it would be kubernetes at the time of the relevant, so will kubernetes all the software also deleted, the problem is also not resolved).

It suddenly occurred to me early that I saw the article that Docker's engine is based on a kind of storage driver provided by device Mapper, and it relies on devicemapper. I then removed it and restarted the service, resolving the issue of Docker not starting properly.

rm-rf/var/lib/docker/# Add the following content vim/etc/docker/daemon.json{    "graph": "/mnt/docker-data",    "Storage-driver": " Overlay "}

[[email protected] ~]# systemctl restart docker[[email protected] ~]# systemctl status Docker docker.service -Docker Application Container Engine loaded:loaded (/usr/lib/systemd/system/docker.service; disabled; vendor Preset:d isabled) active:active (running) since Mon 2017-07-03 10:26:19 CST;           15s ago docs:http://docs.docker.com Main pid:17167 (dockerd-current) CGroup:/system.slice/docker.service ├─17167/usr/bin/dockerd-current--add-runtime Docker-runc=/usr/libexec/docker/docker-runc-current--           Default-runtime=docker-runc--exec-opt native.cgroupdriver=systemd--userlan ... └─17175/usr/bin/docker-containerd-current-l Unix:///var/run/docker/libcontainerd/docker-containerd.sock--shim Docker-containerd-shim--metrics-interval=0--start-timeout 2m-... Jul 10:26:18 aly-hkc-pro-001 dockerd-current[17167]: time= "2017-07-03t10:26:18.961963315+08:00" Level=info msg= " Graph migration to Content-addressability took 0.00 seconds "Jul 10:26:18 Aly-hkc-pro-001 dockerd-current[17167]: time= "2017-07-03t10:26:18.962211996+08:00" level=warning msg= "Mountpoint for PIDs not Found "Jul 10:26:18 aly-hkc-pro-001 dockerd-current[17167]: time=" 2017-07-03t10:26:18.962703210+08:00 " Level=info msg= "Loading containers:start." Jul 10:26:19 aly-hkc-pro-001 dockerd-current[17167]: ... time= "2017-07-03t10:26:19.230715822+08:00" level= Info msg= "Firewalld running:false" Jul 10:26:19 aly-hkc-pro-001 dockerd-current[17167]: time= "2017-07-03t10  : 26:19.379894482+08:00 "Level=info msg=" Default Bridge (DOCKER0) is assigned with an IP address 172.30...IP address "Jul 03 10:26:19 aly-hkc-pro-001 dockerd-current[17167]: time= "2017-07-03t10:26:19.435937423+08:00" Level=info msg= "Loading Containers:done. " Jul 10:26:19 aly-hkc-pro-001 dockerd-current[17167]: time= "2017-07-03t10:26:19.436016788+08:00" Level=info msg= " Daemon has completed initialization "Jul 10:26:19 aly-hkc-pro-001 dockerd-current[17167]: time=" 2017-07-03t10 : 26:19.436052792+08:XX "Level=info msg=" Docker daemon "commit=" 1398f24/1.12.6 "Graphdriver=devicemappe...sion=1.12.6jul 03 10:26:19 aly-hkc-pro-001 dockerd-current[17167]: time= "2017-07-03t10:26:19.441788942+08:00" Level=info msg= "API Listen On/var  /run/docker.sock "Jul 10:26:19 aly-hkc-pro-001 systemd[1]: Started Docker application Container Engine.Hint:Some lines Were ellipsized, use-l to show on full.

The second method serves as a reference:

[[email protected] ~]# yum remove docker[[email protected] ~]# yum Remove docker-selinux [[email  Protected] yum.repos.d]# VI  /etc/yum.repos.d/docker.repo [dockerrepo]name=docker Repositorybaseurl= https://yum.dockerproject.org/repo/main/centos/$releasever/enabled=1gpgcheck=1gpgkey=https:// Yum.dockerproject.org/gpg [[email protected] Yum.repos.d]# yum install docker-engine  installed:   docker-engine.x86_64 0:1.10.2-1.el7.centos                     &N Bsp                as dependencies are installed:  docker-engine-selinux.noarch 0:1.10.2-1. El7.centos    [[email protected] ~]# service Docker startredirecting to/bin/systemctl start   Docker.service[[email protected] ~]# Docker imagesrepository          tag     &NB Sp           IMAGE ID            createD             size [[email protected] yum.repos.d]# Docker versionclient:  Version:     &NBSP;1.10.2&NBSP;API version:  1.22 go version:   Go1.5.3 git commit:   C3959b1 built:        mon 16:16:33 2016 os/arch:     &NBSP;LINUX/AMD64&NBS P Server: version:     &NBSP;1.10.2&NBSP;API version:  1.22 go version:   Go1.5.3 git Commit:   c3959b1 built:        mon 16:16:33 2016 os/arch:     &NBSP;L Inux/amd64[[email protected] yum.repos.d]# 

[[email protected] ~]# yum remove docker[[email protected] ~]# yum Remove docker-selinux [[email  Protected] yum.repos.d]# VI  /etc/yum.repos.d/docker.repo [dockerrepo]name=docker Repositorybaseurl= https://yum.dockerproject.org/repo/main/centos/$releasever/enabled=1gpgcheck=1gpgkey=https:// Yum.dockerproject.org/gpg [[email protected] Yum.repos.d]# yum install docker-engine  installed:   docker-engine.x86_64 0:1.10.2-1.el7.centos                     &N Bsp                as dependencies are installed:  docker-engine-selinux.noarch 0:1.10.2-1. El7.centos    [[email protected] ~]# service Docker startredirecting to/bin/systemctl start   Docker.service[[email protected] ~]# Docker imagesrepository          tag     &NB Sp           IMAGE ID            createD             size [[email protected] yum.repos.d]# Docker versionclient:  Version:     &NBSP;1.10.2&NBSP;API version:  1.22 go version:   Go1.5.3 git commit:   C3959b1 built:        mon 16:16:33 2016 os/arch:     &NBSP;LINUX/AMD64&NBS P Server: version:     &NBSP;1.10.2&NBSP;API version:  1.22 go version:   Go1.5.3 git Commit:   c3959b1 built:        mon 16:16:33 2016 os/arch:     &NBSP;L Inux/amd64[[email protected] yum.repos.d]# 

Installing Docker on Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.