Moment For Technology

Linux centos installs the Docker Shell script

Posted on Aug. 11, 2023, 12:12 a.m. by 丁宗翰
Category: linux Tag: linux

The tools and resource center To help developers work more efficient, to provide around the whole life cycle of the developer tools and resources to

Introduction: Install and create the Test image

! /bin/bash

repo="" if [ ! -e $repo ]; Then # -e; Reference: Shell the if condition judgment file or directory yum install wget - y wget HTTP: / /; Sh centos - yum. Sh else echo "yum has switch" fi DockerInstall () {dci = RPM - qa | grep docker | wc -l if [1] $dci - lt then

Echo "Installing Docker ======="

yum -y remove docker docker-common docker-selinux docker-engine

Uninstall the old version of Docker

yum install -y yum-utils device-mapper-persistent-data lvm2

# configure the source code of yum

yum-config-manager --add-repo

# Add docker yum source code

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

Check the docker version

cat /dev/null /etc/docker/daemon.json ;

# Empty the file and write again

cat /etc/docker/daemon.json EOF { "insecure-registries": [" registry. Local ", "5001", "]", "registry - mirrors" : (" "), "BJP" : "", "data - root" : "/ var/lib/docker", "storage - driver" : "overlay2", "live-restore": true, "log-opts": {

"max-size": "500m"




IPv6 is not required in the file

Mirror accelerator configuration

Yum install -y docker-ce # yum install -y docker-ce #

Yum install docker-ce-VERSION_STRING

Yum install docker - ce - 18.03.1. Ce

Start docker systemctl enable docker # Start docker version # Check docker version # docker run hell-world # Start a Docker to verify that the installation succeeded else

Echo "Docker installed successfully"





systemctl daemon-reload

systemctl restart docker.service

systemctl status docker -l

docker info

docker pull centos:7

# Pull centos7 image



wget ; sh

About (Moment For Technology) is a global community with thousands techies from across the global hang out!Passionate technologists, be it gadget freaks, tech enthusiasts, coders, technopreneurs, or CIOs, you would find them all here.