dockerfile更改docker镜像源

方法一:

更换源

复制代码
RUN sed -i s@/deb.debian.org/@/mirrors.aliyun.com/@g /etc/apt/sources.list \
&& apt-get update

方法二:

复制代码
RUN echo  "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free" >/etc/apt/sources.list && \
    echo  "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free" >>/etc/apt/sources.list && \
    echo  "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free" >>/etc/apt/sources.list && \
    echo  "deb http://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free" >>/etc/apt/sources.list

centos dockerfile 安装Python3.11

复制代码
# 安装Python3.11依赖
RUN yum -y install gcc zlib zlib-devel libffi libffi-devel
RUN yum -y install bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel xz-devel gdbm-devel

# 安装Python3.11
RUN wget https://mirrors.huaweicloud.com/python/3.11.8/Python-3.11.8.tar.xz
RUN tar -xvf Python-3.11.8.tar.xz
RUN cd Python-3.11.8 && ./configure && make && make install && cd ..

ubuntu dockerfile 安装Python3.11

复制代码
# 修改镜像源
RUN echo  "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free" >/etc/apt/sources.list && \
    echo  "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free" >>/etc/apt/sources.list && \
    echo  "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free" >>/etc/apt/sources.list && \
    echo  "deb http://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free" >>/etc/apt/sources.list

# 安装Python3.11依赖
RUN apt-get update && apt install wget build-essential libreadline-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev

# 安装Python3.11
RUN wget https://mirrors.huaweicloud.com/python/3.11.8/Python-3.11.8.tar.xz
RUN tar -xvf Python-3.11.8.tar.xz
RUN cd Python-3.11.8 && ./configure && make && make install && cd ..

Python镜像源:

Index of python-local/3.11.8

相关推荐
无忧.芙桃8 小时前
Linux系统编程(四):用户与权限管理
linux·运维·服务器
谙弆悕博士10 小时前
多智能体架构详解:层级树状架构(分级主从型)
运维·架构·大模型·agent·多智能体·langgraph·层级树状
byte轻骑兵12 小时前
如何为你的 Web 应用添加文档编辑能力:ONLYOFFICE 文档集成实战
docker·私有化部署·系统集成·在线协作·wsl2·onlyoffice docs
HMS工业网络13 小时前
工业远程访问的五项安全部署原则
运维·服务器·安全
吴建旭 智宅焕14 小时前
智能家居全国交付中执行端能力评估与分级调度架构设计:从注册数量到交付确定性的系统实现
运维·智能家居·devops
IT大白鼠15 小时前
eBPF 观测入门:用 bpftrace 给服务器装上“内核摄像头“
运维·服务器·ebpf
分布式存储与RustFS16 小时前
Zeppelin 笔记本重启就丢:三个环境变量把 .zpln 存进 RustFS 桶
运维·云原生·开源·对象存储·分布式存储·s3·性能基准
好用斋17 小时前
内网测速 LibreSpeed:网页版 Docker 测速服务
运维·docker·容器
江华森18 小时前
从零开始:智能运维概念与Linux环境准备完全指南
linux·运维
橙橙子23019 小时前
Linux----libevent
linux·运维·服务器