What is docker
Docker's idea comes from the container. What problem does the container solve? In a large ship, the goods can be placed neatly. And all kinds of goods are standardized by containers, and containers will not affect each other. Then I don't need a ship for fruit and a ship for chemicals. As long as these goods are well sealed in containers, I can transport them all in a big ship.
What can docker do
Docker can solve the problems that virtual machines can solve, and also solve the problems that virtual machines cannot solve due to high resource requirements. The things docker can handle include:
- Isolate application dependencies
- Create an application image and copy it
- Create ready to use apps that are easy to distribute
- Allow instances to expand simply and quickly
- Test applications and then destroy them
The idea behind Docker is to create a portable lightweight container for software programs, so that it can run on any machine with Docker installed, regardless of the underlying operating system, just as ambitious shipbuilders have successfully created containers without considering which ship to install on.
Application scenario
Docker is an open source engine, which can easily create a lightweight, portable and self-sufficient container for any application. The containers that developers compile and test on notebooks can be deployed in batch in the production environment, including VMs (virtual machine), bare metal, OpenStack cluster and other basic application platforms.
Docker is usually used in the following scenarios:
- Automatic packaging and publishing of web applications;
- Automated testing and continuous integration and release;
- Deploy and adjust databases or other background applications in a service-oriented environment;
- Compile from scratch or extend the existing OpenShift or Cloud Foundry platform to build your own PaaS environment.
Installing docker in CentOS 7
1,Uninstall older versions of Docker Services: yum remove docker docker-common container-selinux docker-selinux docker-engine 2,install yum-utils,It provides yum-config-manager Utilities: yum install -y yum-utils 3,add to Docker-CE Repository (no) (1)Official website yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo (2)domestic yum-config-manager --add-repo https://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repo 4,Add manually Docker-Ce memory pool: vim /etc/yum.repos.d/docker-ce.repo [docker-ce-stable] name=Docker CE Stable - $basearch baseurl=https://mirrors.ustc.edu.cn/docker-ce/linux/centos/$releasever/$basearch/stable enabled=1 gpgcheck=0 5,Update the index list of packages: yum makecache fast 6,Install the latest version of Docker service yum install -y device-mapper-persistent-data lvm2 yum install -y docker-ce 7,start-up Docker Services: systemctl start docker 8,send Docker Random self start of service: systemctl enable docker 9,uninstall Docker Services: yum remove -y docker-ce rm -rf /var/lib/docker
Installed in ubantu
1.Uninstall old version docker service apt remove docker docker-engine docker.io rm -rf /var/lib/docker/ 2.stay Ubuntu-14.04 Installation required on AUFS Package to support aufs Storage driver: apt install -y linux-image-extra-$(uname -r) linux-image-extra-virtual stay Ubuntu-16.04 And later Docker-CE Default use overlay2 As a storage driver, it does not need to be installed; 3.Install the base package: apt install -y apt-transport-https ca-certificates curl software-properties-common python3-software-properties 4.add to Docker Official GPG secret key official curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - domestic curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | apt-key add - 5,add to Docker-CE memory pool Official website add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" domestic add-apt-repository "deb [arch=amd64] http://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu $(lsb_release -cs) stable" 6,Update the index list of packages apt update 7,Install the latest docker service apt install -y docker-ce 8,start-up Docker service # Ubuntu-14 $ service start docker # Ubuntu-16 $ systemctl start docker 9,uninstall Docker service apt purge docker-ce $ rm -rf /var/lib/docker
Configure accelerator
- centos (1),configuration file mkdir -p /etc/docker vi /etc/docker/daemon.json Add the following { "registry-mirrors": ["https://a5aghnme.mirror.aliyuncs.com"] } (2),restart docker systemctl daemon-reload && systemctl restart docker.service - ubuntu (1),To configure a private accelerator: curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://6bdc63e3.m.daocloud.io (2),configuration file mkdir -p /etc/docker vim /etc/docker/daemon.json { "registry-mirrors": ["https://9cs90h5l.mirror.aliyuncs.com"] } (2)restart Docker Services: \# Ubuntu-14 $ service docker restart \# Ubuntu-16/CentOS-7 $ systemctl restart docker