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

相关推荐
老黄编程29 分钟前
配置镜像仓库镜像(Registry Mirror)的指南
docker
掘根30 分钟前
【Docker】容器操作和实战
运维·docker·容器
奔跑吧 android3 小时前
【Docker】【2.docker 安装 ubuntu 桌面版】
ubuntu·docker·容器
前端世界5 小时前
从零搭建多子网 DHCP 服务:CentOS 双网卡多作用域实战与原理解析
linux·运维·centos
头发那是一根不剩了5 小时前
Docker Desktop 安装教程和最佳实践
运维·docker·容器
路由侠内网穿透.6 小时前
本地部署轻量级持续集成工具 Drone CI 并实现外部访问
运维·服务器·ci/cd·远程工作
白小云<6 小时前
Kubernetes service管理
云原生·容器·kubernetes
janthinasnail7 小时前
使用Docker搭建Swagger接口文档工具
docker·api接口文档
tianyuanwo7 小时前
K8s Dashboard运维技巧全面经验总结
linux·运维·kubernetes
失因7 小时前
Kubernetes(K8s)基础知识与部署
云原生·容器·kubernetes