Docker installation learning notes

Posted by alfoxy on Tue, 11 Jan 2022 14:25:10 +0100

1. Environment configuration (it is best to use CentOS7, and you can try 8 if you want)

docker is usually installed in linux environment, so it is useless to visit Alibaba cloud servers.

Watch the activity and find a cheap or free white whoring.



Reset next password




Open XShell



Enter the account and password just now

Just connect. (if you don't have an ECS, find a virtual machine)

2. Installing and configuring docker

View the kernel of the system:

uname -r
[root@iZbp1g4b3m5ahxkuhpte7bZ ~]# uname -r
4.18.0-348.2.1.el8_5.x86_64

View system configuration

cat /etc/os-release
[root@iZbp1g4b3m5ahxkuhpte7bZ ~]# cat /etc/os-release
NAME="CentOS Linux"
VERSION="8"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="CentOS Linux 8"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:8"
HOME_URL="https://centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-8"
CENTOS_MANTISBT_PROJECT_VERSION="8"

Uninstall the old version, official website( https://docs.docker.com/engine/install/centos/ )

 sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine

Some installation packages required to install docker

yum install -y yum-utils


Set up a mirrored warehouse

yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo # foreign address
    
    # Set up Alibaba cloud Docker image warehouse
yum-config-manager \
    --add-repo \
    https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo # alicloud address

Always report errors with CentOS8, and replace CentOS8 with CentOS7. It doesn't cost money to change the version

Just stop the instance and change the version

[root@iZbp1g4b3m5ahxkuhpte7bZ ~]# uname -r
3.10.0-1160.49.1.el7.x86_64
[root@iZbp1g4b3m5ahxkuhpte7bZ ~]# cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

Again

Remove the original

yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine


Installation package

yum install -y yum-utils


Set Ali warehouse (installed with warehouse)

yum-config-manager \
    --add-repo \
    https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo 


Update yum package index

yum makecache fast


Install docker

You can install it this way (install the latest)

 yum install docker-ce docker-ce-cli containerd.io


You can also install it this way (select the version to install)

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


Then choose y all the way (it should be two Y's)

Start docker

systemctl start docker

View version

docker version

Set startup and self startup

systemctl enable docker


Try Hello world on the official website

docker run hello-world

After running, look at the downloaded image

docker images


Uninstall docker

# 1. Uninstall dependency
yum remove docker-ce docker-ce-cli containerd.io
# 2. Delete resources/ var/lib/docker is the default working path of docker
rm -rf /var/lib/docker

Installation complete

3. Install docker with pagoda panel

Look at the pagoda official website (very easy to remember BT)
https://www.bt.cn/

With command

yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh ed8484bec

After running, display this, two addresses, user name and password (pay attention to the Yellow characters, remember to release the 8888 port if you don't release it)

You can get this page by pasting the Internet address on the browser

If you don't get this page, go to alicloud and open port 8888




After saving, try again. Can you access the pagoda
Just paste the account and password in XShell (tick to enter)

It's coming in (this thing is very convenient, keep looking)

You can install docker directly here or install various software on your server

Like some commonly used software can be installed

Just click Install and wait (click mysql to pop up this, just wait)

It's really over this time

Topics: Operation & Maintenance Docker Container