docker_practice/install/offline.md

250 lines
7.5 KiB
Go
Raw Normal View History

# 线Docker
[TOC]
线`Docker`
<img src="_images/image-20200412202617411.png" alt="Docker-offile-install-top" style="zoom:30%;" />
## Centos7 线Docker
### YUM
使
#### (A)
```bash
#
wget -O /etc/yum.repos.d/docker-ce.repo https://download.docker.com/linux/centos/docker-ce.repo
sudo sed -i 's+download.docker.com+mirrors.tuna.tsinghua.edu.cn/docker-ce+' /etc/yum.repos.d/docker-ce.repo
yum update
```
```bash
sudo yum list docker-ce --showduplicates|sort -r
Loading mirror speeds from cached hostfile
Loaded plugins: fastestmirror
docker-ce.x86_64 3:19.03.8-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.7-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.6-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.5-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.4-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.3-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.2-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.1-3.el7 docker-ce-stable
....
```
#### (A)
```bash
sudo yum install --downloadonly --downloaddir=/tmp/docker-19.03 docker-ce-19.03.8-3.el7 docker-ce-cli-19.03.8-3.el7
```
```bash
Dependencies Resolved
====================================================================================================================================================================================
Package Arch Version Repository Size
====================================================================================================================================================================================
Installing:
docker-ce x86_64 3:19.03.8-3.el7 docker 25 M
Installing for dependencies:
container-selinux noarch 2:2.107-3.el7 extras 39 k
containerd.io x86_64 1.2.13-3.1.el7 docker 23 M
docker-ce-cli x86_64 1:19.03.8-3.el7 docker 40 M
Transaction Summary
====================================================================================================================================================================================
Install 1 Package (+3 Dependent packages)
Total download size: 87 M
Installed size: 363 M
Background downloading packages, then exiting:
(1/4): container-selinux-2.107-3.el7.noarch.rpm | 39 kB 00:00:00
(2/4): containerd.io-1.2.13-3.1.el7.x86_64.rpm | 23 MB 00:00:00
(3/4): docker-ce-19.03.8-3.el7.x86_64.rpm | 25 MB 00:00:00
(4/4): docker-ce-cli-19.03.8-3.el7.x86_64.rpm | 40 MB 00:00:00
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 118 MB/s | 87 MB 00:00:00
exiting because "Download Only" specified
```
#### (C-N)
```bash
yum install *.rpm
```
#### (C-N)
#####
```bash
sudo yum install yum-plugin-versionlock
```
#####
```bash
sudo yum versionlock add docker
```
#####
```bash
sudo yum versionlock list
```
```bash
Loaded plugins: fastestmirror, versionlock
3:docker-ce-18.09.9-3.el7.*
versionlock list done
```
#####
```bash
sudo yum install docker-ce
Loaded plugins: fastestmirror, versionlock
Loading mirror speeds from cached hostfile
Excluding 1 update due to versionlock (use "yum versionlock status" to show it)
Package 3:docker-ce-18.09.9-3.el7.x86_64 already installed and latest version
Nothing to do
```
#####
```bash
sudo yum versionlock delete docker-ce
```
```bash
Loaded plugins: fastestmirror, versionlock
Deleting versionlock for: 3:docker-ce-18.09.9-3.el7.*
versionlock deleted: 1
```
#####
```bash
sudo yum versionlock delete all
```
### YUM Docker
#### ISO File AB
```bash
#
rm -f /etc/yum.repo.d/*
# iso
mount /dev/cdrom /mnt
```
```bash
#
cat >/etc/yum.repos.d/local_files.repo<< EOF
[Local_Files]
name=Local_Files
baseurl=file:///mnt
enable=1
gpgcheck=0
gpgkey=file:///mnt/RPM-GPG-KEY-CentOS-7
EOF
```
```bash
# ,createrepo
yum clean all
yum install createrepo -y
```
#### BASEB
```bash
# apache
yum install httpd -y
#
mount /dev/cdrom /mnt
# centos
mkdir /var/www/html/base
#
cp -R /mnt/Packages/* /var/www/html/base/
createrepo /var/www/html/centos/
systemctl enable httpd
systemctl start httpd
```
#### Docker-CE A
Docker-ce
```bash
#
wget -O /etc/yum.repos.d/docker-ce.repo https://download.docker.com/linux/centos/docker-ce.repo
sudo sed -i 's+download.docker.com+mirrors.tuna.tsinghua.edu.cn/docker-ce+' /etc/yum.repos.d/docker-ce.repo
```
```bash
# docker-ce
mkdir /tmp/docker-ce/
#
reposync -r docker-ce-stable -p /tmp/docker-ce/
```
#### B
docker-ce 线
```bash
# docker-ce /var/www/html/docker-ce
#
createrepo /var/www/html/docker-ce/
```
#### YUM C...N
```bash
rm -f /etc/yum.repo.d/*
cat >/etc/yum.repos.d/local_files.repo<< EOF
[local_base]
name=local_base
# B
baseurl=http://x.x.x.x/base
enable=1
gpgcheck=0
proxy=_none_
[docker_ce]
name=docker_ce
# B
baseurl=http://x.x.x.x/base
enable=1
gpgcheck=0
proxy=_none_
EOF
```
#### Docker C...N
```bash
sudo yum makecache fast
sudo yum install docker-ce docker-ce-cli containerd.io
sudo systemctl enable docker
```