简体   繁体   中英

start container fails when running the image

i'm trying to run my docker image and to start my container but i'm getting an error:

this is my 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"]

after generating the image, i tried to run it but i got this error

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

i updated my ENTRYPOINT by using the path to the file and i got an error also

ENTRYPOINT [/application/scripts/trails_application_start.sh"]

the error here is

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

this is the output of 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

and these are the two command i'm running:

docker build --no-cache -t image-name:latest -f Dockerfile .
docker run --read-only -p 8080:9420 image-name  

any help please?

While running the docker image you need to tell your host what platform to use as image's platform doesn't match. Try passing --platform linux/amd64 flag with docker run command. Alternatively, you can pass this flag while building the docker image too. I hope that might solve your issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM