Install docker on centos

Source: Internet
Author: User
Tags yum repolist

Install dockerce

1. Install the required dependency packages, mainly involvingyum-config-manager/device-mapper-persistent-dataAndlvm2

Run the following command to check whether the local dependency package has been installed:

# You can use the tab key to complete related commands, yum-config-manageryum List Installed | grep device-mapper-persistent-data # Check whether device-mapper-persistent-data is installed # the following result indicates that the installation is complete # device-mapper-persistent-data.x86_64 0.7.3 -3. el7 @ anacondayum List Installed | grep lvm2 # the installation is complete. # lvm2.x86 _ 64. 02.177-4. el7 @ Anaconda # lvm2-libs.x86_64. 02.177-4. el7 @ Anaconda # lvm2-python-libs.x86_64. 02.177-4. el7 @ anaconda

As shown above, the installation is complete and you do not need to install it again. If the installation is not completed, follow the instructions on the official website to install

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

2. Add a stable docker Source

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

Run the command Yum repolist # enabled is displayed by default. If the disabled parameter is not effective, you can view the available sources.

3. Install docker

sudo yum install docker-ce

4. Add docker as self-starting and start the docker service at the same time

Sudo systemctl status docker. Service # view service status sudo systemctl enable docker # Start sudo systemctl start docker from startup # Start the service

After docker version is started, the system prompts that no permission is required.

Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.38/version: dial unix /var/run/docker.sock: connect: permission denied

View the/etc/group file and find that the docker user group already exists, but no common user is configured

docker:x:983

(If the docker user group is not configured, run the sudo groupadd docker command to add a user group)

In this case, execute the command

Sudo usermod-Ag docker fengxm # fengxm is the username to be added

After the execution is completed, docker: X: 983: fengxm is successfully added.

Restart the computer or logout/login, and then run the docker version command.

[[email protected] ~]$ docker versionClient: Version:           18.06.1-ce API version:       1.38 Go version:        go1.10.3 Git commit:        e68fc7a Built:             Tue Aug 21 17:23:03 2018 OS/Arch:           linux/amd64 Experimental:      falseServer: Engine:  Version:          18.06.1-ce  API version:      1.38 (minimum version 1.12)  Go version:       go1.10.3  Git commit:       e68fc7a  Built:            Tue Aug 21 17:25:29 2018  OS/Arch:          linux/amd64  Experimental:     false

 

 

Reference:

Official docker documentation

User Configuration

Install docker on centos

Related Article

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.