Entrypoint exec error 190 or 348 only if pulled from docker hub

The dockerfile.

So earlier I had error 348 which was resolved by adding the missing shebang in my entrypoint script.

However, a few hours later, a similar problem turned up. I tried various things but eventually noticed that if I pulled the image directly from docker hub, I get either of these errors:

docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"pipe.sh\": executable file not found in $PATH": unknown.

or

standard_init_linux.go:190: exec user process caused "exec format error"

These errors don’t occur if I git pull and docker build, then docker run the locally built image.

Does anyone know how to solve this issue?

As strange as it is, my issue has been solved by building the container locally, running it, then comitting that container as-is to docker hub. From then on, pulls from docker hub do not have those issues.

Anyone have insight as to why this happens? Is this a bug?