CentOS Install the Docker tutorial _docker

Source: Internet
Author: User
Tags socket docker hub docker run

Install via Yum

Requires root or sudo permission

Yum Package update to latest

$ sudo yum update

Add Docker Yum Source

$ sudo tee/etc/yum.repos.d/docker.repo <<-' EOF '
[Dockerrepo]
name=docker Repository
baseurl= https://yum.dockerproject.org/repo/main/centos/$releasever/
enabled=1
gpgcheck=1
gpgkey=https:// YUM.DOCKERPROJECT.ORG/GPG
EOF

Install Docker Package

$ sudo yum install Docker-engine

Start the Docker daemon

$ sudo service docker start

Run a container through a test mirror to verify that the Docker is properly installed

$ sudo docker run Hello-world unable to find image ' hello-world:latest ' locally latest:pulling from Hello-world a821 9747be10:pull Complete 91c95931e552:already exists hello-world:latest:the image you are pulling has been.
  Important:image verification is a tech preview feature and should. digest:sha256:aa03e5d0d5553b4c3473e89c8619cf79df368babd1.7.1cf5daeb82aab55838d status:downloaded Newer image for
  Hello-world:latest Hello from Docker.


  This message shows the your installation appears to be working correctly.
   To generate this message, Docker took the following Steps:1 Docker client contacted the Docker.
      2. The Docker daemon pulled the "Hello-world" image from the Docker Hub.
   (assuming it is not already locally available.) 3. The Docker daemon created a new container from this image which runs the executable that produces the output
   are currently reading. 4. The Docker DaeMon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run a Ubuntu container with: $ docker run-it Ubuntu bash for more Exampl

 Es and ideas, visit:http://docs.docker.com/userguide/

Install by script

Requires root or sudo permission

Yum Package update to latest

$ sudo yum update

Run the Docker installation script

$ Curl-ssl https://get.docker.com/| Sh

This script adds the Docker.repo warehouse and installs the Docker

Start the Docker daemon

$ sudo service docker start

Run a container through a test mirror to verify that the Docker is properly installed

$ sudo docker run Hello-world

Create a Docker user group

The Docker daemon is bound to a UNIX socket instead of a TCP port. By default, UNIX sockets belong to the root user and to users with sudo permissions. For this reason, the Docker daemon needs to run under the root user all the time.

To avoid the Docker command, create a Unix group called Docker and add users to it. When the Docker daemon starts, it makes the ownership to the Unix socket read/writable by the Docker group.

To avoid running the Docker command, you need to use the sudo command to create a UNIX user group called Docker and add users who need to run Docker. When you start running the Docker daemon, the members of the Docker user group have read and write access to the UNIX socket.

To create a Docker user group and add users:

1. Need Root or sudo permission
2. Create Docker user groups and add users

sudo usermod-ag Docker your_username

3. Quit and log in to Your_username, and if you are your_username to quit and log in again, make sure that your users are running the correct permissions.
4. Verify run Docker no longer requires sudo command

$ Docker Run Hello-world

Boot Run Docker

$ sudo chkconfig docker on

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.