janiussyafiq commented on issue #13775:
URL: https://github.com/apache/apisix/issues/13775#issuecomment-5422125208

   Thanks for the screenshots. They show the pod has no `command`/`args` 
override and exits with code 0 in the same second with no logs. That means the 
image's `CMD` is no longer `docker-start`.
   
   The cause is `docker commit`: it saves the container's runtime settings into 
the image. If the container was started with a shell (for example `docker run 
-it --user root apache/apisix:3.17.0-ubuntu /bin/bash`), the committed image 
gets `CMD ["/bin/bash"]`, the same way it got `USER root`. Your Dockerfile does 
not set `CMD`, so the kaniko build inherits it. In the pod, 
`/docker-entrypoint.sh /bin/bash` runs `bash` with no stdin, which exits 0 
immediately with no output. I reproduced this locally with the same steps.
   
   You can confirm with:
   
   ```bash
   docker inspect xxx/apisix-deploy:4708a41c --format '{{json .Config.Cmd}}'
   ```
   
   Expected `["docker-start"]`; `["/bin/bash"]` means this is the cause.
   
   **Fix: build from the official image and drop `docker commit`.** The commit 
was only needed because `apt-get` fails as the `apisix` user. Switch user 
inside the Dockerfile instead:
   
   ```dockerfile
   FROM apache/apisix:3.17.0-ubuntu
   
   USER root
   RUN apt-get update && apt-get install -y --no-install-recommends 
openjdk-21-jdk-headless \
       && rm -rf /var/lib/apt/lists/*
   
   COPY target/*.jar /usr/local/apisix/
   RUN chown -R apisix:root /usr/local/apisix/
   
   USER apisix
   ```
   
   This keeps `ENTRYPOINT`, `CMD ["docker-start"]` and `USER apisix` from the 
official image, so no override is needed in the Deployment, and upgrading 
APISIX later is just changing the `FROM` line. I verified this Dockerfile 
against etcd: the container starts and serves `Server: APISIX/3.17.0`.
   
   If you need to keep the current image for now, adding `CMD ["docker-start"]` 
to the Dockerfile or `args: ["docker-start"]` in the Deployment also works.
   
   Note: `bash /docker-entrypoint.sh` with no argument never starts APISIX, 
even in the official image. Use `bash /docker-entrypoint.sh docker-start` for 
manual tests.
   
   Could u first confirm with above fix first? Let me know.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to