我正在尝试运行我的docker映像并启动我的container,但我得到一个错误:
这是我的DockerFile:
FROM artifactory...../xxx_docker-local/xxx_java_maven:11
COPY settings/conf /application/conf
WORKDIR /application/conf
RUN ls -lrth
COPY settings/front /application/front
COPY settings/scripts /application/scripts
WORKDIR /application/scripts/
RUN ls -lrth
COPY application/target/xxx-application.jar /application/service/xxx-application.jar
WORKDIR /application/scripts/
RUN chmod +x *.sh
EXPOSE 9420
RUN pwd
ENTRYPOINT ["xxx_application_start.sh"]
生成图像后,我尝试运行它,但我得到这个错误
WARNING: The requested image's platform (linux/amd64) does not match the detected
host platform (linux/arm64/v8) and no specific platform was requested
docker: Error response from daemon: failed to create shim task: OCI runtime create
failed: runc create failed: unable to start container process: exec:
"xxx_application_start.sh": executable file not found in $PATH: unknown.
ERRO[0000] error waiting for container: context canceled
我使用文件路径更新了ENTRYPOINT,但也收到错误
ENTRYPOINT [/application/scripts/trails_application_start.sh"]
这里错误是
WARNING: The requested image's platform (linux/amd64) does not match the detected
host platform (linux/arm64/v8) and no specific platform was requested
exec /application/scripts/xxx_application_start.sh: no such file or
directory
这是docker build的输出
> #14 [10/13] WORKDIR /application/scripts/
#14 sha256:a57bf9c86907fb870c9af30bf81067acda86b224f2d5145027463aa929d2e115
#14 DONE 0.0s
#15 [11/13] RUN chmod +x *.sh
#15 sha256:954310bda76055d5682d752342d69aac231e09f8b9f6be7ad59a8611c6d0538b
#15 DONE 0.2s
#16 [12/13] RUN ls -lrth
#16 sha256:c1c4351c5aa33a313b980994c6fadf0d5ad15b3997bf5d59d9f547c946ba8992
#16 0.174 total 24K
#16 0.174 -rwxrwxr-x 1 root root 1.1K Jan 18 14:03 xxx_application_stop.sh
#16 0.174 -rwxrwxr-x 1 root root 2.2K Jan 18 15:52 xxx_application_start.sh
#16 DONE 0.2s
#17 [13/13] RUN pwd
#17 sha256:c9594028015f207f90cea0e4c4f8bb94b83ee608b238ab2b970d6a4003053da8
#17 0.330 /application/scripts
#17 DONE 0.3s
#18 exporting to image
#18 sha256:e8c613e07b0b7ff33893b694f7759a10d42e180f2b4dc349fb57dc6b71dcab00
#18 exporting layers
#18 exporting layers 0.3s done
#18 writing image sha256:8b8d1a822756e236a1fa7c729cbc25e386484b13fee6b8efed876ee561b6eb3e done
#18 naming to docker.io/library/image-name:latest done
#18 DONE 0.3s
这是我运行的两个命令:
docker build --no-cache -t image-name:latest -f Dockerfile .
docker run --read-only -p 8080:9420 image-name
有什么需要帮忙的吗?
1条答案
按热度按时间aij0ehis1#
运行docker映像时,您需要告诉主机要使用的平台,因为映像的平台不匹配。尝试使用docker run命令传递
--platform linux/amd64
标志。或者,您也可以在构建docker映像时传递此标志。我希望这可能会解决您的问题。