0

I can't run my docker image in my container in Docker-Desktop on Windows: docker image - container

Here is my file entrypoint.sh :

#!/bin/sh

echo $0

set -e

# Global variables
PYTHONPATH="${PYTHONPATH}:/app/src"
PYTHON_BIN=$(which python3)
APP_ENTRYPOINT="/app/src/loadguard/main.py"

# Entrypoint parameter
[ -z "${APP_MODULE}" ] && echo "Environment variable is missing: $(APP_MODULE)" && exit 128

# Exports environment variables
export PYTHONPATH

command=${1}
echo "${command}"
case ${command} in
   test)
      echo '{"command": "test"}'
      ;;
   console)
      echo '{"command": "console"}' && bash
      ;;
   wait)
      echo '{"command": "wait"}' && sleep infinite
      ;;
   run)
      echo '{"command": "run"}' \
      && exec poetry run ${APP_ENTRYPOINT} run --module "${APP_MODULE}"
      ;;
   *)
      echo '{"command": "$@"}' \
      && exec "$@"
      ;;
esac

When I put LF on the file entrypoint.sh on Vscode here is the error in the docker logs: "No such file or directory't execute 'python3"

and when I put CRLF here is the error : "exec /opt/entrypoint.sh: no such file or directory"

In the 2 cases my API-1 container does not launch. I tried to reinstall python, to modify my environment variables, switch to a linux terminal thanks to WSL but nothing works.

I don't know what to do anymore, I've tried several things but nothing works, I need help please.

Kevin JM
  • 1
  • 1
  • Can you delete this script entirely; make your image have a `WORKDIR /app/src`; and set its `CMD poetry run loadguard/main.py --module "$APP_MODULE"`? – David Maze Apr 14 '23 at 20:05
  • It also might help to [edit] the question to include the actual error message as plain text. The first error message as you've written it hints at incorrect line endings, if something is trying to run `python3\r` (maybe a "shebang" line in the `main.py` script, but with DOS line endings). – David Maze Apr 14 '23 at 20:12

0 Answers0