Docker installation (centos7)

As a programmer, if you don’t know what Docker is, it’s a bit outrageous. Although I knew it a long time ago, I haven’t studied it systematically yet. Haha, I started to install and learn by myself today. Let's study together.

1. What exactly is Docker?

Docker is an open source application container engine that allows developers to package their applications and dependencies into a portable image, and then publish it to any popular Linux or Windows machine, which can also be virtualized. Containers use the sandbox mechanism completely, and there will be no interfaces between them.

2. What is the use of Docker?

The startup speed of Docker is much faster than traditional virtual machines. It can be started in seconds. Docker has a very high resource utilization rate of the system. A host can run hundreds of docker containers. Docker can be customized applications. Mirror to achieve continuous integration, continuous delivery, and deployment. Because Docker ensures the consistency of the execution environment and makes application migration easier, Docker can run on many platforms.

Three, the three basic concepts of Docker.

Image : Docker image (Image) is equivalent to a root file system.

Container : The relationship between the image and the container is like the class and instance in object-oriented programming. The image is a static definition, and the container is the entity of the image at runtime. Containers can be created, started, stopped, deleted, suspended, etc.

Repository : Repository can be regarded as a code control center for storing images.

Docker uses a client-server (C/S) architecture model and uses remote APIs to manage and create Docker containers.

Docker containers are created through Docker images.

The relationship between containers and mirrors is similar to objects and classes in object-oriented programming.

 

Fourth, the installation of Docker (Centos7).

1.Docker 要求 CentOS 系统的内核版本高于 3.10 ,查看本页面的前提条件来验证你的CentOS 版本是否支持 Docker 。
   通过 uname -r 命令查看你当前的内核版本。
   uname -r
2.使用 root 权限登录 Centos。
   su root
3.确保 yum 包更新到最新。
   sudo yum update
4.卸载旧版本(如果安装过旧版本的话).
   sudo yum remove docker  docker-common docker-selinux docker-engine
5.安装需要的软件包, yum-util 提供yum-config-manager功能,另外两个是devicemapper驱动依赖的.
   sudo yum install -y yum-utils device-mapper-persistent-data lvm2
6.设置yum源.
   1)使用官方源地址(比较慢)
   sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
   2)阿里云
   sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
7.可以查看所有仓库中所有docker版本,并选择特定版本安装.
   yum list docker-ce --showduplicates | sort -r
8.安装Docker。(我安装的是docker-ce-18.03.1.ce)
   sudo yum install docker-ce-18.03.1.ce
9.启动Docker,并加入开机启动。
   sudo systemctl start docker
   sudo systemctl enable docker
10.验证是否安装成功。
   docker version
   
   

Docker installation success diagram

Ok, so far, the docker installation success diagram shown above appears, even if the installation is successful. Then you can start to learn how to use docker.

Guess you like

Origin blog.csdn.net/wzs535131/article/details/108113687