Install docker and pull image to access the website (Chapter 1)

Time:2020-10-30

1. Docker requires the kernel version of CentOS system to be higher than 3.10uname -r Command to check whether your current kernel version supports the installation of docker

2. Update Yum package: sudo Yum update

3. Install the required software package. Yum util provides the yum config manager function, and the other two are dependent on the devicemapper driver

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

4. Set Yum source: sudo Yum config Manager — add repo https://download.docker.com/linux/centos/docker-ce.repo

     

5. You can view all docker versions in all warehouses and select a specific version to install: Yum list docker CE — showduplicates | sort – R

    

6. Install docker: sudo Yum install docker-ce-17.12.0.ce

7. Start docker service: systemctl start docker

8. Configure alicloud image warehouse (image acceleration)

 

a. Log in to alicloud management background; then search for the container image and click container image service to log in to the console.

    Install docker and pull image to access the website (Chapter 1)

b. The successful login page is as follows. (if the open service window pops up, just close it)

    Install docker and pull image to access the website (Chapter 1)

c. Click image center > Image accelerator to see that alicloud has provided you with an exclusive image acceleration address.

    Install docker and pull image to access the website (Chapter 1)

 

D. configure the customized image warehouse address of docker. Please change the image warehouse address in the following commandhttps://kqh8****.mirror.aliyuncs.comReplace with the exclusive image acceleration address provided by alicloud.

tee /etc/docker/daemon.json <'EOF'
    {
        "registry-mirrors": ["https://kqh8****.mirror.aliyuncs.com"]
    }
    EOF

9. Reload service configuration file: systemctl daemon reload

10. Restart the docker service: systemctl restart docker 11. View the available versions of nginx in the docker image warehouse: docker search nginx 12. Pull the latest version of nginx image: docker pull nginx:latest 13. View local images: docker images

The command output is as follows:

    Install docker and pull image to access the website (Chapter 1)

14. Operation container:docker run --name nginx-test -p 8080:80 -d nginx

Command parameter description:

    • –Name nginx test: container name.
    • -P 8080:80: port mapping, mapping the local 8080 port to port 80 inside the container.
    • -D nginx: set the container to run in the background all the time.

The command output is as follows:

    Install docker and pull image to access the website (Chapter 1)

15. Input in the browser address barhttp://:8080Access the nginx service.

    Install docker and pull image to access the website (Chapter 1)

The next chapter explains how docker deploys the. Net core project【 https://www.cnblogs.com/smile-live/p/13606316.html ]