I'm trying to run an existing binary file in a Docker container.
Files in current folder:
$ ls .
app Dockerfile run.sh
Dockerfile:
FROM alpine:latest
COPY . /app/
RUN chmod +x /app/run.sh && chmod +x /app/app
WORKDIR /app
ENTRYPOINT ["./run.sh"]
run.sh:
#!/bin/sh
./app
ls
(The ls
command is used to check if the app
not exists)
Build command and outputs:
$ sudo docker build . -t app_test
Sending build context to Docker daemon 3.427MB
Step 1/5 : FROM alpine:latest
---> 11cd0b38bc3c
Step 2/5 : COPY . /app/
---> 4c69dfe88b2e
Step 3/5 : RUN chmod +x /app/run.sh && chmod +x /app/app
---> Running in 0dbdc9045827
Removing intermediate container 0dbdc9045827
---> 9193aeee2c8f
Step 4/5 : WORKDIR /app
---> Running in 9ecb2ad7c3f1
Removing intermediate container 9ecb2ad7c3f1
---> 1c748d0cb0b2
Step 5/5 : ENTRYPOINT ["./run.sh"]
---> Running in 24ebb7500202
Removing intermediate container 24ebb7500202
---> adcd6e94a37f
Successfully built adcd6e94a37f
Successfully tagged app_test:latest
Run command:
$ sudo docker run -it app_test
./run.sh: line 2: ./app: not found
Dockerfile app run.sh
From the output of ls
command, we can find app
exists, but it seems sh
cannot find it.
I also tried run ./app
directly or use ["sh", "run.sh"]
instead in ENTRYPOINT
or CMD
, but it doesn't help.
EDIT: This app
is a closed source software and only a compiled executable is distributed. I'm sorry I cannot provide more information.