Docker+Alibaba Cloud image container for environment backup and acquisition

Docker+Alibaba Cloud image container for environment backup and acquisition

Why do I need to store it to compile an environment?

1.
          Be consistent: If you compile and build the local environment, test environment, pre-release environment, and online environment of a project one by one, it will not only be time-consuming, but also problems caused by inconsistent environments during the period! For example: the same code will explode when the local environment runs to the test environment without any problem, sometimes it is caused by the inconsistent environment.

2. Save time:
          Compile and install an LNMP environment such as the basic version. If you are proficient, it will take nearly two or three hours, if you are not proficient, it will take a day; while using docker, after the first installation is completed, the same environment will be deployed later You only need as fast as 1 minute


Stop talking nonsense, start to do it

1) Install docker on the personal server

//
yum update

// yum-util  yum-config-manager devicemapper 
sudo yum install -y yum-utils device-mapper-persistent-data lvm2

//
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

//docker 
yum list docker-ce --showduplicates | sort -r

//
sudo yum install docker-ce

//
sudo systemctl start docker

//
sudo systemctl enable docker

//( client service docker )
docker version
 


2) Bind the github account on Alibaba Cloud

Aliyun mirror warehouse address: promotion.aliyun.com/ntms/act/ku...

(Search centos in the search box to automatically jump to the mirror warehouse address, and create it according to Alibaba Cloud's prompts)

Bind your github according to the prompts


3) Obtain centos7 mirror

//
docker pull centos

//
docker run -it centos/bin/bash

//txt 
//LNMP
mkdir/home/test
touch test.txt
exit

//
docker commit -a "zhao" -m "centosTest" 05d85063be6a centostest

//
docker images

//-u 
//registry.cn-hangzhou.aliyuncs.com 
docker login -u=13250333601 registry.cn-hangzhou.aliyuncs.com

// 


Before pushing, you need to go to Alibaba Cloud to get the upload address, as shown below




4) To upload, upload requires two steps:
one is compiling and naming, and the other is uploading. Alibaba Cloud has related detailed operation instructions.



Download the mirror system

This step is quite simple, one command is complete, that is to say, you need to deploy your environment in other places in the future, it is only a matter of command, about a minute

sudo docker pull registry.cn-hongkong.aliyuncs.com/zzj_docker/test:[ ]