wecom-dashboards/deploy/DOCKER-IMAGE-FIX.md

86 lines
1.7 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Docker 镜像问题说明
## 问题原因
`openjdk:8-jre-alpine` 镜像已被弃用,无法从 Docker Hub 拉取。
## 解决方案
已将 Dockerfile 中的基础镜像更改为 `eclipse-temurin:8-jre-alpine`
### Eclipse Temurin 是什么?
- Eclipse Temurin 是 OpenJDK 的官方继任者
- 由 Eclipse Adoptium 项目维护
- 完全兼容 OpenJDK
- 持续更新和维护
## 其他可用的 Java 8 镜像
如果 `eclipse-temurin:8-jre-alpine` 也无法拉取,可以尝试以下替代方案:
### 1. Amazon Corretto推荐
```dockerfile
FROM amazoncorretto:8-alpine-jre
```
### 2. Eclipse Temurin非 Alpine
```dockerfile
FROM eclipse-temurin:8-jre
```
注意:体积较大(约 200MB vs 85MB
### 3. Azul Zulu
```dockerfile
FROM azul/zulu-openjdk-alpine:8-jre
```
### 4. 使用国内镜像加速
如果网络问题导致拉取失败,可以配置 Docker 镜像加速器:
#### 阿里云镜像加速
```json
{
"registry-mirrors": [
"https://docker.m.daocloud.io",
"https://registry.docker-cn.com",
"https://docker.mirrors.ustc.edu.cn"
]
}
```
配置位置:
- **Windows**: Docker Desktop -> Settings -> Docker Engine
- **Linux**: `/etc/docker/daemon.json`
配置后重启 Docker
```bash
# Linux
sudo systemctl restart docker
# Windows
重启 Docker Desktop
```
## 当前配置
已修改 [backend/Dockerfile](backend/Dockerfile) 使用:
```dockerfile
FROM eclipse-temurin:8-jre-alpine
```
现在可以重新尝试构建:
```bash
docker compose up -d
```
## 如果仍然失败
1. 检查网络连接
2. 配置镜像加速器
3. 或者使用非 Alpine 版本(体积更大但更稳定):
```dockerfile
FROM eclipse-temurin:8-jre
```