Install docker image on CentOS8

1. Virtual machine installation and CentOS system installation

The author of this article is using VMware virtual machine and CentOS8 system, the specific installation method can refer to the following link.
CentOS8 installation steps

Resource acquisition

CentOS8 ISO image file:
Link: https://pan.baidu.com/s/1KUYMTMhZLUwi5Z3IyaATtw
Extraction code: a8pe

Two, set up the CentOS8 network

The network adapter of CentOS 8 system chooses NAT mode, which is more convenient in future operations.
NAT settings

Open the system, log in to the root user, enter to ip addview the network situation, ens33 is the local network card to

cd /etc/sysconfig/network-scriptsopen the directory, lsview the files in the directory, ifcfg-ens33 is the name of your network card to
Insert picture description here
vi ifcfg-ens33open the configuration file, press the ESC key and the letter i to enter the increase Mode, change onboot=no to onboot=yes , press Esc to exit the editing mode, enter to :wqsave and exit;
Insert picture description here
Insert picture description here

Three, CentOS8 change yum source

Backup the original yum source

cd /etc/yum.repos.d

cp CentOS-Base.repo CentOS-Base.repo.bak

Insert picture description here
Download the corresponding version of the repo file

wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo

Insert picture description here
Clear the old cache and generate a new cache

yum clean all

yum makecache
Insert picture description here
Update

yum update -y
Insert picture description here
It will take some time to download here. I am about 700 m or so. After downloading, it looks like this: Start running the script to upgrade.

Fourth, install docker

Use the Docker repository for installation. Before installing Docker Engine-Community on the new host for the first time, you need to set up the Docker repository. After that, you can install and update Docker from the repository. Install the required software packages.

sudo yum install -y yum-utils \ 2 > device-mapper-persistent-data \ 3 > lvm2 

Insert picture description here
Set up a stable warehouse, choose Alibaba Cloud warehouse

sudo yum-config-manager \ 2 > --add-repo \ 3 > http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo 

Insert picture description here
Install Docker Engine-Community, you can specify the version or not specify the version to
see which versions of docker are in the warehouse

yum list docker-ce --showduplicates | sort -r
Insert picture description here

Install a specific version through its full package name.
Specify the version to install docker:

sudo yum install --allowerasing docker-ce-20.10.3 docker-ce-cli-20.10.3 containerd.io

Insert picture description here
Insert picture description here
Start docker after successful installation

sudo systemctl start docker

Through the docker version, you can see the installed docker version
Insert picture description here
docker run hello-world to see if the docker is successfully installed

sudo docker run hello-world

Insert picture description here

So that's it for installing docker. The following steps are to install the mirror image that our school needs to experiment (only for our school's course use), for reference only, do not imitate, because it will cause the computer to burst.

Five, load the school mirror

To download the image, type in the command line:

docker pull iwebsec/iwebsec

Insert picture description here
Insert picture description here
Run, command line input:

docker run -d -p 13307:3306 -p 80:80 -p 7001:7001 -p 8080:8080 -p 8088:8088 -p 8000:8000 -p 6379:6379 iwebsec/iwebsec

Insert picture description here

Six, the experiment was successful

Test whether you can open the vulnerable website, open the browser, enter: localhost, the
Insert picture description here
experiment is successful

Reference article:
Install Docker on CentOS 8

Guess you like

Origin blog.csdn.net/z_Love_Study/article/details/115050199