Centos7.6

4. 更新 Yum 缓存:

1
2
sudo yum clean all
sudo yum makecache

yum多线程设置

1
sudo vi /etc/yum.conf
1
max_parallel_downloads=10

查看系统小版本

1
rpm -q centos-release

解决了两个小时的centos base repo

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
[base]
name=CentOS-$releasever - Base
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

[extras]
name=CentOS-$releasever - Extras
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
gpgcheck=1
enabled=0

[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0

腾讯源

1
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos7_base.repo

清缓存

1
2
3
yum clean all
yum makecache
yum install docker-ce

docker无yum

在Docker容器中安装Vim

如果您的Docker容器中没有安装vim,可以按照以下步骤进行安装。安装过程取决于容器所基于的Linux发行版。

1. 访问Docker容器

首先,使用以下命令进入正在运行的Docker容器中的shell会话:

1
docker exec -it <container_name> /bin/bash

<container_name>替换为您的Docker容器的名称或ID。

2. 安装Vim

进入容器后,根据Linux发行版使用相应的包管理器安装vim

对于Debian/Ubuntu系列容器:

1
2
apt update
apt install vim -y

对于CentOS/RHEL系列容器:

1
yum install vim -y

3. 保存更改(可选)

如果您希望在未来运行该容器时仍然保留vim,可以将更改提交到一个新的镜像中:

1
docker commit <container_name> <new_image_name>

现在,您可以使用这个预装了vim的新镜像。

4. 修复依赖问题(如果需要)

在某些情况下,您可能会遇到依赖问题。对于基于Ubuntu/Debian的容器,您可以使用以下命令修复破损的依赖项:

1
apt --fix-broken install

然后,重新尝试安装vim

总结

通过这些步骤,您可以成功地在Docker容器中安装vim,并在需要时保存更改。

docker源

1
/etc/yum.repos.d/docker-ce.repo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
[docker-ce-stable]
name=Docker CE Stable - $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/$basearch/stable
enabled=1
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

[docker-ce-stable-debuginfo]
name=Docker CE Stable - Debuginfo $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/debug-$basearch/stable
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

[docker-ce-stable-source]
name=Docker CE Stable - Sources
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/source/stable
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

[docker-ce-test]
name=Docker CE Test - $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/$basearch/test
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

[docker-ce-test-debuginfo]
name=Docker CE Test - Debuginfo $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/debug-$basearch/test
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

[docker-ce-test-source]
name=Docker CE Test - Sources
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/source/test
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

[docker-ce-nightly]
name=Docker CE Nightly - $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/$basearch/nightly
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

[docker-ce-nightly-debuginfo]
name=Docker CE Nightly - Debuginfo $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/debug-$basearch/nightly
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

[docker-ce-nightly-source]
name=Docker CE Nightly - Sources
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/source/nightly
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
yum clean all
1
2
sudo yum makecache fast
sudo yum install docker-ce docker-ce-cli containerd.io

mkdir /root/Rabbit
cd /root/Rabbit
docker run –name rabbitpro -p 5701:1234 -d -v “$(pwd)”/data:/Rabbit/data -it –privileged=true ht944/rabbitpro:latest

卸载docker

1
2
3
4
5
6
7
8
9
10
11
yum erase docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine \
docker-ce

重新安装docker-ce

1
yum install docker-ce -y

更新 yum

1
yum update

启动docker

1
systemctl start docker