I want to run a container with docker-compose. My dockerfile is installing some stuff and at the end it looks like this:
FROM adoptopenjdk/openjdk16
...
COPY ./myfiles /mydockerfiles
ENTRYPOINT [ "/mydockerfiles/init.sh" ]
My docker compose file looks something like this
version: '3.3'
services:
myservice:
build: .
environment:
restart: "no"
ports:
- 10000:10000
volumes:
- type: bind
source: ./dockerdata
target: /mydockerfiles
deploy:
resources:
limits:
memory: 4G
reservations:
memory: 4G
Pretty basic stuff so far in my opinion. But for some reason I always get this error:
ERROR: for ... Cannot start service myservice: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "/mydockerfiles/init.sh": stat /mydockerfiles/init.sh: no such file or directory: unknown
ERROR: for myservice Cannot start service myservice: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "/mydockerfiles/init.sh": stat /mydockerfiles/init.sh: no such file or directory: unknown ERROR: Encountered errors while bringing up the project.
If however I open up a shell into the container and run the script manually it all works fine. Also during the build process if once tried to do a chmod +x
on the init.sh-File and no error occured. So why is the file available during building, a manual bash; but not when using docker-compose up
. What am I missing???