Get the App
SLTechnology News&Howtos  ›  Servers  › 

Centos7.6 Docker offline yum source

Shulou Source: shulou.com Published: 2022-06-02 17:47:42 09月22日 Update

Set up the yum source repository

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

Use Ali Cloud Docker Yum source

Yum-config-manager-- add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

After the creation is completed, execute the following command to empty and re-establish the yum cache to see if the creation is successful.

Yum makecache fast

Yum clean all

Yum makecache

Yum repolist

List and sort which versions are in the repository. Here are examples, from high to low.

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

Install the specified version

Yum install docker-ce-18.06.2.ce

Uninstall the historical version

Yum remove docker\

Docker-client\

Docker-client-latest\

Docker-common\

Docker-latest\

Docker-latest-logrotate\

Docker-logrotate\

Docker-selinux\

Docker-engine-selinux\

Docker-engine

Open the yum source retention installation package

Vim / etc/yum.conf

Keepcache=0

Modified to:

Keepcache=1

Use createrepo to add a local directory as an yum source

Yum-y install createrepo

Mkdir-pv / app/yum/docker/

The yum source rpm copy / app/yum/docker/ directory will be downloaded

Cd / var/cache/yum/x86_64/7

Cp docker-ce-stable/packages/ / app/yum/docker/

Cp base/packages/ / app/yum/docker/

Cp extras/packages* / app/yum/docker/

Use createrepo to add the local directory as the yum source, and some files will be automatically created in this directory

Createrepo / app/yum/docker/

Create docker installation source files

Vim docker.repo

[docker]

Name=docker

Baseurl= file:///app/yum/docker/

Enabled=1

Gpgcheck=0

Gpgkey= file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Centos-7

Execute the command to see if docker-ce can query the

Yum list docker-ce

Yum-y install docker-ce

Set up startup Docker

Systemctl enable docker

Systemctl start docker

Tags: Directory version repository command low-level high-level success example history copy file source file cache Ali sort query Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Redmi Shulou Technology MySQL Huawei