Docker 进行在进行构建的时候,因为有时候需要进行安装工具,默认的镜像地址是国外地址,需要配置国内的镜像源,加快速度!
- 阿里巴巴 - 开源软件镜像站:https://developer.aliyun.com/mirror/
- 中国科学技术大学 - 开源软件镜像站:http://mirrors.ustc.edu.cn
- 清华大学 - 开源软件镜像站:https://mirrors.tuna.tsinghua.edu.cn/help/
- 网易 - 开源软件镜像站:http://mirrors.163.com/.help/
基于 Alpine 镜像
基础镜像:
# Use Alpine Linux As Base Image
FROM alpine:latest
#FROM alpine:3.18
# The Author
MAINTAINER hiwepy@gmail.com
# Update Apk Repositories to Aliyun、Ustc、Tuna
#RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
#RUN echo "#https://dl-cdn.alpinelinux.org/alpine/v3.18/main" > /etc/apk/repositories
#RUN echo "#https://dl-cdn.alpinelinux.org/alpine/v3.18/community" >> /etc/apk/repositories
RUN echo "https://mirrors.aliyun.com/alpine/v3.18/main/" > /etc/apk/repositories
RUN echo "https://mirrors.aliyun.com/alpine/v3.18/community/" >> /etc/apk/repositories
#RUN echo "http://mirrors.ustc.edu.cn/alpine/v3.18/main" >> /etc/apk/repositories
#RUN echo "http://mirrors.ustc.edu.cn/alpine/v3.18/community" >> /etc/apk/repositories
#RUN echo "https://mirrors.tuna.tsinghua.edu.cn/alpine/v3.18/main" >> /etc/apk/repositories
#RUN echo "https://mirrors.tuna.tsinghua.edu.cn/alpine/v3.18/community" >> /etc/apk/repositories
RUN apk update && apk upgrade && rm -rf /var/cache/apk/*
Nginx 镜像:
FROM nginx:stable-alpine
# 写此文章时,nginx:stable-alpine 使用 nginx:1.24.0-alpine-slim ,它基于 alpine:3.17
# https://hub.docker.com/_/nginx
# https://github.com/nginxinc/docker-nginx/blob/1a8d87b69760693a8e33cd8a9e0c2e5f0e8b0e3c/stable/alpine-slim/Dockerfile
RUN echo "https://mirrors.aliyun.com/alpine/v3.17/main/" > /etc/apk/repositories
RUN echo "https://mirrors.aliyun.com/alpine/v3.17/community/" >> /etc/apk/repositories
RUN apk update && apk upgrade && rm -rf /var/cache/apk/*
OpenJDK 镜像:
#FROM reg.hiwepy.com/base-image/openjdk-pinpont:1
#FROM reg.hiwepy.com/base-image/openjdk-8-shanghai:alpine
#FROM openjdk:11-jre-alpine
#FROM openjdk:11-jdk-alpine
#FROM openjdk:8-jre-alpine
#FROM openjdk:8-jdk-alpine
FROM openjdk:8-jdk-alpine
RUN echo "https://mirrors.aliyun.com/alpine/v3.9/main/" > /etc/apk/repositories
RUN echo "https://mirrors.aliyun.com/alpine/v3.9/community/" >> /etc/apk/repositories
RUN apk update && apk upgrade && rm -rf /var/cache/apk/*
基于 Ubuntu 镜像
基础镜像:
https://hub.docker.com/_/ubuntu
- Ubuntu Jammy 22.04 (LTS)
- Ubuntu Focal 20.04 (LTS)
# Use Ubuntu Linux As Base Image
FROM ubuntu:latest
#FROM ubuntu:jammy
#FROM ubuntu:focal
# The Author
MAINTAINER hiwepy@gmail.com
# Update Apt Repositories to Aliyun、Ustc、Tuna、163
RUN sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list
#RUN sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
#RUN sed -i 's/archive.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list
#RUN sed -i 's/archive.ubuntu.com/mirrors.163.com/g' /etc/apt/sources.list
RUN apt-get update
RUN apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release
https://yeasy.gitbook.io/docker_practice/install/ubuntu
基于 Debian 镜像
https://yeasy.gitbook.io/docker_practice/install/debian
基础镜像:
- Debian Bullseye 11
- Debian Buster 10
作者:Jeebiz 创建时间:2023-06-27 17:21
最后编辑:Jeebiz 更新时间:2024-11-27 12:52
最后编辑:Jeebiz 更新时间:2024-11-27 12:52