Preface:Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate applications from infrastructure so that you can deliver software quickly. With Docker, you can manage your infrastructure just like you manage your applications. By leveraging Docker's method of rapidly delivering, testing, and deploying code, you can significantly reduce the delay between writing code and running it in production. To make development, deployment, testing, and distribution more efficient and easier, let's install Docker and experience its charm! System Requirements:
Installation environment:This article mainly installs Docker in the Liunx operating system CentOS8.4. Before installation, we can check our system version by using the command: lsb_release -a (as shown in the figure below). Note: Do not install Docker using the yum command without configuring the Docker YUM repository. Uninstall old versions:The package name of the old version of Docker in CentOS is docker or docker-engine. If you have installed an old version of Docker on your Linux CentOS system, you need to uninstall the old version of Docker and its related dependencies by executing the following command: sudo yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-selinux \ docker-engine-selinux \ docker-engine Because my system was just installed, when I executed the above command, it prompted that no package to be removed was found! If Note: The contents of the What exactly does yum do?Simple description: yum is called a package manager, which is mainly used to solve four problems: downloading, dependency, installation, and uninstallation. Detailed description: https://www.jb51.net/article/165658.htm Install using yum:Execute the following commands to install dependency packages and some necessary system tools: sudo yum install -y yum-utils device-mapper-persistent-data lvm2 Configure yum stable mirror source:Due to domestic network reasons, it is recommended to use the Docker CE image source station provided by Alibaba Cloud! sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo Official mirror source address: # Official source# sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo Install Docker Update sudo yum install docker-ce docker-ce-cli containerd.io The following are the dependencies that were successfully installed: Check the successfully installed docker version: docker -v CentOS8 Additional Settings Since CentOS8 firewall uses First, we check the status of the firewall. If the firewall status is turned on, we perform the following operations: systemctl status firewalld We can use # FirewallBackend=nftables FirewallBackend=iptables Or execute the following command: firewall-cmd --permanent --zone=trusted --add-interface=docker0 firewall-cmd --reload Start the Docker service:Execute the sudo service docker start command to start the Docker service and an exception is displayed: Redirecting to /bin/systemctl start docker.service If you see an exception, you need to execute the relevant systemctl commands, because different Linux distributions have different commands for starting the Docker service. sudo systemctl enable docker sudo systemctl start docker Finally check the docker running status systemctl status docker Start the Docker daemon:Official tutorial: https://docs.docker.com/config/daemon/systemd/ Manual Start After installing Docker, you need to start the Docker daemon. Most Linux distributions use sudo systemctl start docker Automatically start at system bootIf you want Docker to start at boot time, see Configure Docker to start at boot time 👉. Docker basic commands:Start Docker: systemctl start docker Stop Docker: systemctl stop docker Restart Docker: systemctl restart docker Check the docker status: systemctl status docker Start at boot: systemctl enable docker Current system docker information: docker info List all containers: docker ps -a Stop the container: docker start container ID or container name Close the container directly: docker kill container ID or container name Restart the container: docker restart container ID or container name Delete container: docker rm container ID or container name View the image: docker image ls More command searches (recommended): Docker command online quick reference manual Test whether Docker is installed correctly First, we enter Note: This command will cause Docker to pull the hello-world image from the official repository to the local computer (if the image does not exist locally), and automatically instantiate a container for it. Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 2db29710123e: Pull complete Digest: sha256:37a0b92b08d4919615c3ee023f7ddb068d12b8387475d64c622ac30f45c29c51 Status: Downloaded newer image for hello-world:latest Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3. The Docker daemon creates a new container from that image which runs the executable that produces the output you 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 an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/ View the hello-World image and container: Docker learning seriesday1, comprehensive Docker quick start tutorial 👉 Day 2, CentOS 8.4 install Docker👉 Reference articles:Install Docker Engine on CentOS CentOS 7 (install using yum) This is the end of this article about installing Docker on CentOS 8.4. For more information about installing Docker on CentOS 8.4, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Use HTML to write a simple email template
Recently, I encountered many problems when instal...
First of all, we need to understand that GB2312, ...
1. Go to the official website: D:\mysql-5.7.21-wi...
Table of contents background Server Dependencies ...
Some time ago, I submitted a product version to t...
1 Introduction In the article "Start Postgre...
js execution Lexical analysis phase: includes thr...
1. Use the transform attribute to display the ima...
Table of contents 1. typeof operator 2. instanceo...
Preface When sharing a page, you hope to click th...
1. Upper and lower list tags: <dl>..</dl...
Table of contents 1. Map method 2. Application ba...
1. Add the following code to http{} in nginx.conf...
This article shares with you the installation tut...
HTML provides five space entities with different ...