【docker】容器优化:一行命令换源

原理:

根据清华源提供的Ubuntu 软件仓库进行sources.list替换

ubuntu | 镜像站使用帮助 | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror

1、换源

echo "">/etc/apt/sources.list \
    && echo "# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释">>/etc/apt/sources.list \
    && echo "deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse">>/etc/apt/sources.list \
    && echo "# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse">>/etc/apt/sources.list \
    && echo "deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse">>/etc/apt/sources.list \
    && echo "# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse">>/etc/apt/sources.list \
    && echo "deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse">>/etc/apt/sources.list \
    && echo "# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse">>/etc/apt/sources.list \
    && echo "deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse">>/etc/apt/sources.list \
    && echo "# deb-src http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse">>/etc/apt/sources.list \
    && echo "# 预发布软件源,不建议启用">>/etc/apt/sources.list \
    && echo "# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse">>/etc/apt/sources.list \
    && echo "# # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse">>/etc/apt/sources.list

2、更新软件列表

apt-get clean && apt-get update

相关推荐

  1. docker容器优化一行命令

    2024-05-12 17:16:07       31 阅读
  2. pycharm 包安装失败,下载,一行命令

    2024-05-12 17:16:07       21 阅读
  3. Docker 容器命令总汇

    2024-05-12 17:16:07       53 阅读
  4. Docker-05 Docker容器命令

    2024-05-12 17:16:07       30 阅读
  5. Docker一个的应用容器引擎

    2024-05-12 17:16:07       37 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-05-12 17:16:07       70 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-05-12 17:16:07       74 阅读
  3. 在Django里面运行非项目文件

    2024-05-12 17:16:07       61 阅读
  4. Python语言-面向对象

    2024-05-12 17:16:07       71 阅读

热门阅读

  1. Vue.js介绍

    2024-05-12 17:16:07       23 阅读
  2. matlab实现机器学习

    2024-05-12 17:16:07       31 阅读
  3. 以AI对抗AI,瑞数“动态安全+AI”助力在线反欺诈

    2024-05-12 17:16:07       34 阅读
  4. 链表初步之找最大结点

    2024-05-12 17:16:07       34 阅读
  5. ubuntu bind9 主从配置

    2024-05-12 17:16:07       27 阅读
  6. 华为昇腾310B1平台深度学习算法模型转换

    2024-05-12 17:16:07       31 阅读
  7. 前端:零宽字符

    2024-05-12 17:16:07       31 阅读
  8. Hive on Tez 作业优化参数

    2024-05-12 17:16:07       27 阅读