docker替换源&docker镜像安装VIM

Posted 潜伏的猎豹

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了docker替换源&docker镜像安装VIM相关的知识,希望对你有一定的参考价值。

docker替换源
先看下docker下原有的信息docker info

主要的代码块

 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Registry Mirrors:
  https://docker.mirrors.ustc.edu.cn/
 Live Restore Enabled: false

其中包含了以下这些标识已经配置了国内源,如果没有则进行更新一下:
Registry Mirrors:
https://docker.mirrors.ustc.edu.cn/
在此目录下创建此文件,注:如果存在则进行修改
/etc/docker/daemon.json 添加下面的信息


  "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"]

然后 systemctl restart docker 再进行docker info 查看是否有上图的配置。因为我这里已经配置了所以docker info时已经显示了源

docker镜像下安装vim
首先看下docker的linux内核版本
cat /etc/os-release 这个命令是要登录进去docker镜像后输入

PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

其中如果是debian则可以使用清华大学镜像站
官网地址https://mirrors.tuna.tsinghua.edu.cn/help/debian/ 一定要看下帮助文档
看下自己的Debian 版本,因为有些博客写的镜像地址都是老版本的所以可能会有问题 这是个坑


我的是11(bullseye)
一般情况下,将 /etc/apt/sources.list 文件中 Debian 默认的源地址 http://deb.debian.org/ 替换为镜像地址即可。
Debian Buster 以上版本默认支持 HTTPS 源。如果遇到无法拉取 HTTPS 源的情况,请先使用 HTTP 源并安装:

默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
#默认的安全使用源镜像
deb https://security.debian.org/debian-security bullseye-security main contrib non-free

```bash
echo "">sources.list
echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free">>sources.list
echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free">>sources.list
echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free">>sources.list
echo "deb https://security.debian.org/debian-security bullseye-security main contrib non-free">>sources.list

然后:
apt-get update
apt-get install vim

Docker——镜像源更换国内源

前言

在windows上安装了docker服务想替换为国内源

步骤

镜像源

Docker中国区官方镜像
https://registry.docker-cn.com

 

网易
http://hub-mirror.c.163.com

 

ustc 
https://docker.mirrors.ustc.edu.cn

 

中国科技大学
https://docker.mirrors.ustc.edu.cn

 

阿里云容器服务(需要先创建容器镜像)
https://cr.console.aliyun.com/

设置步骤

技术图片

以上是关于docker替换源&docker镜像安装VIM的主要内容,如果未能解决你的问题,请参考以下文章

Docker——镜像源更换国内源

docker下载镜像与替换默认源

Docker设置镜像加速

如何修改docker pull镜像源

如何修改Windows上Docker的镜像源

kali linux 2020 安装docker并配置国内镜像源