docker-compose up
字符串
返回:
[+] Building 1.7s (4/4) FINISHED docker:default
=> [web internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [web internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 701B 0.0s
=> ERROR [web internal] load metadata for docker.io/library/openjdk:17-a 1.7s
=> [web auth] library/openjdk:pull token for registry-1.docker.io 0.0s
------
> [web internal] load metadata for docker.io/library/openjdk:17-alpine:
------
failed to solve: openjdk:17-alpine: no match for platform in manifest sha256:4b6abae565492dbe9e7a894137c966a7485154238902f2f25e9dbd9784383d81: not found
型
经过研究,似乎问题是与兼容性(我使用的是Mac,图像是从Windows构建的).我试图改变参数,如platform linux/x86_64
和做rm ~/.docker/config.json
等建议在论坛上,虽然错误仍然显示.
如何运行docker-compose?
Dockerfile:
#pulling base image and updating apk
FROM openjdk:17-alpine
RUN apk update && \
apk add --no-cache tzdata
#making directory for jar and transfer it
RUN mkdir /opt/app
COPY target/dormitory_marketplace-0.0.1-SNAPSHOT.jar /opt/app/dm.jar
WORKDIR /opt/app
#running jar
CMD java -jar dm.jar
型
docker-compose.yml:
version: "3"
services:
web:
build: .
container_name: web
ports:
- "8080:8080"
depends_on:
- redis
environment:
REDIS_HOST: redis
redis:
container_name: redis
image: "redis:latest"
型
1条答案
按热度按时间hiz5n14c1#
openjdk:17-alpine
仅适用于amd 64,不适用于arm 64,并且也已弃用。请使用eclipse-temurin:17
或更好的eclipse-temurin:17-jre
(您的Dockerfile
表明JRE对您来说已经足够);它们基于Ubuntu Jammy。如果您更喜欢Alpine,则可以使用amazoncorretto:17-alpine
,但它不提供JRE;要自行创建它,请参阅How to create an Alpine-based JRE-only Docker image of Amazon Corretto?,例如