Centos deployment docker

Zero increase sudo privileges

In the / etc / sudoers add

## Allow root to run any commands anywhere
root ALL=(ALL) ALL
rzx ALL=(ALL) ALL

 

First, the replacement of a warehouse source

1. Backup

sudo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2. Download and replace

Sudo curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

3. Production cache

sudo yum makecache

 

Second, the installation docker

1. Install yum-utils

sudo yum install -y yum-utils

2. Add docker warehouse

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

3. Install docker

sudo yum install docker-ce

4. View version

docker -v
Docker version 19.03.8, build afacb8b

5. Turn docker Service

sudo systemctl start docker.service

6. boot from Kai

sudo systemctl enable docker.service

7. Replace the docker hub mirroring

In the / etc / docker New

sudo vim daemon.json

{
  "registry-mirrors": ["https://registry.docker-cn.com"]
}

 

Third, the deployment mysql

1. The image file pulling mysql

sudo docker pull mysql:5.7

2. Open container

docker run -d --name mysql --env MYSQL_ROOT_PASSWORD=rzx980411 -p 3306:3306 mysql:5.7

3. Use of Ali cloud ECS, to set about the security group, released a designated port, you can connect up.

 

 

 

 

Guess you like

Origin www.cnblogs.com/-rzx-/p/12668056.html