Closed moluzhui closed 8 months ago
chmod +x start.sh
chmod +x wait-for.sh
chmod +x wait-for.sh
@yokaimeow I added executable permissions, then rebuilt the image and ran it. But the error persists, and I try to enter directly through the following command when running the image. The files have permissions.
$ docker run --rm -it --entrypoint="" simplebank:latest sh
/app # ls -lah
total 62M
drwxr-xr-x 1 root root 23 Nov 30 17:16 .
drwxr-xr-x 1 root root 18 Dec 1 17:04 ..
-rw-rw-r-- 1 root root 204 Nov 23 14:28 app.env
-rwxr-xr-x 1 root root 13.1M Nov 30 16:33 main
-rwxr-xr-x 1 1001 ntp 48.7M Jun 11 22:21 migrate
drwxr-xr-x 2 root root 138 Nov 16 15:54 migration
-rwxrwxr-x 1 root root 164 Nov 30 17:15 start.sh
-rwxrwxr-x 1 root root 4.2K Nov 29 15:16 wait-for.sh
Then I go in and execute the following command, and the debug log can be printed normally. This question is a bit strange
/app # /app/start.sh /app/main
run db migration
start the app
...
gin log
I think the container not on the same docker network.
docker compose up -d --build
It seems like your shebang in your start.sh is not correct:
#!/bin/sh
You are missing the "!".
The shebang (#!) is used to tell the system what interpreter to use to parse the rest of the file, so it could be causing your error.
It seems like your shebang in your start.sh is not correct:
#!/bin/sh
You are missing the "!". The shebang (#!) is used to tell the system what interpreter to use to parse the rest of the file, so it could be causing your error.
thank you very much. I made such a low-level mistake.
I followed the video to learn how to build the image. When I ran the container, the following error occurred.
My Dockerfile is as follows
But when I comment out ENTRYPOINT, there are no errors and the debug log of the gin framework can be printed normally.
And when I use the following docker compose to run, this error will not be reported, and the debug log of the gin framework can be printed normally.
My start.sh is as follows, and also granted executable permissions
I don't know where the error is caused. Look forward to your reply.