Fourth: Docker installs and launches an HTTP container

Source: Internet
Author: User

Knowledge background

Official Document: https://docs.docker.com/engine/installation/

Docker is divided into the Community version (CE) and Enterprise Edition (EE), their biggest difference is: The community version is open source free, Enterprise Edition is charged.
The Docker Community Edition is preferred for those who want to learn about Docker containers, or small development teams.

1. Uninstall the old version of the Docker container

Yum Remove Docker Docker-common docker-selinux docker-engine

2. There are three types of Docker CE installation methods

A. Using Docker mirroring for easy installation and upgrade, this method is recommended

B. Download Docker rpm package to install, most likely to encounter a dependency package problem

C. In the Test and development environment, you can choose to install the Docker in an automated script

3. Installing with a mirrored warehouse

A. If you first install Dcoker CE, you need to set up a Docker installation source

Yum install-y yum-utils Device-mapper-persistent-data lvm2

Description: Data persistence device and LVM2 required driver support for mapper

B. Execute the following command to set a stable mirror source
Yum-config-manager--add-repo Https://download.docker.com/linux/centos/docker-ce.repo

4. Installing the Docker CE

Yum Install-y Docker-ce

5. If you are installing Docker in a production environment, you need to specify the appropriate version to install instead of installing the latest Docker

Use the following command to list the Docker image version in the mirrored warehouse and use the Sort tool to sort the Docker version from high to low
[email protected] ~]# Yum list Docker-ce--showduplicates | Sort-r
Loading mirror speeds from cached hostfile
Loaded Plugins:fastestmirror, LangPacks
Installed Packages

    • epel:mirror.lzu.edu.cn
      docker-ce.x86_64 17.12.0.ce-1.el7.centos docker-ce-stable
      docker-ce.x86_64 17.12.0.ce-1.el7.centos @docker-ce-stable
      docker-ce.x86_64 17.09.1.ce-1.el7.centos docker-ce-stable
      docker-ce.x86_64 17.09.0.ce-1.el7.centos docker-ce-stable
      docker-ce.x86_64 17.06.2.ce-1.el7.centos docker-ce-stable
      docker-ce.x86_64 17.06.1.ce-1.el7.centos docker-ce-stable
      docker-ce.x86_64 17.06.0.ce-1.el7.centos docker-ce-stable
      docker-ce.x86_64 17.03.2.ce-1.el7.centos docker-ce-stable
      docker-ce.x86_64 17.03.1.ce-1.el7.centos docker-ce-stable
      docker-ce.x86_64 17.03.0.ce-1.el7.centos docker-ce-stable
      Available Packages

Description: Specifies that when installing the Docker version, use the following command to install

Yum Install <FULLY-QUALIFIED-PACKAGE-NAME>

6. Set up Docker boot up

Systemctl Enable Docker.service

Systemctl Start Docker.service

7. Verify that Docker installation is installed successfully and that the Docker installation is successful if the following information is returned

8. Install the HTTPD service in the Docker container and map the host's 80 port to the HTTPD 80 port

[email protected] ~]# Docker run-d-P 80:80 httpd
Unable to find image ' httpd:latest ' locally
Latest:pulling from LIBRARY/HTTPD
F49cf87b52c1:pull Complete
02ca099fb6cd:pull Complete
De7acb18da57:pull Complete
770c8edb393d:pull Complete
0e252730aeae:pull Complete
6288e83d58fa:pull Complete
A91ad03b2178:pull Complete
Digest:sha256:643ca2ed9f6caf1f392184aee05a8f2cd478bdacbd350ea6b4dbc8f5b8e400a8
status:downloaded newer image for Httpd:latest
0747f02bb2304ef964ed153e6e81f3f083965f95f12ad9a70c95b7f329243a2c
Docker:error response from Daemon:driver failed programming external connectivity on endpoint mystifying_jennings (86440 11e3dab6725c314f6e634444ca6b6cfe3792d6f504a12af2e065d4c448f): Error starting userland proxy:listen TCP 0.0.0.0:80: Bind:address already in use.

After installation, enter the host address on the Web page to access the HTTP container

Fourth: Docker installs and launches an HTTP container

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.