drf_course icon indicating copy to clipboard operation
drf_course copied to clipboard

Dockerfile misconfiguration

Open WulffenSec opened this issue 3 years ago • 14 comments

Hey I don't know if this is a linux issue or may happen in windows too but the docker-compose -d up --build is throwing a: "Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "/code/docker/entrypoints/entrypoint.sh": permission denied: unknown"

Solution: A simple change in "backend/docker/docker_files/Dockerfile" last line from: ENTRYPOINT [ "/code/docker/entrypoints/entrypoint.sh"] To: ENTRYPOINT ["bash", "-e", "/code/docker/entrypoints/entrypoint.sh"] Solves the issue. Hope it helps!

WulffenSec avatar Dec 22 '22 01:12 WulffenSec

Hi, Yes I was facing the same issue in PopOS. Your solution worked for me. Thanks

Tez01 avatar Jan 22 '23 20:01 Tez01

Thanks so much @WulffenSec for creating this issue 🙌🏿 I also ran into this problem and your solution removed the issue for me. Running on KDE neon 5.26

leni1 avatar Jan 23 '23 12:01 leni1

Hi @WulffenSec im having another issue after replacing the code as you suggested.

2023-03-15 17:14:17 Unknown command: 'makemigrations\r'. Did you mean makemigrations? 2023-03-15 17:14:17 Type 'manage.py help' for usage.

Basically it's running the container but when it hits the entrypoint.sh file for some reason its running 'makemigrations\r' instead of just 'makemigrations'

here is what's in my entrypoint.sh(which I have not made a change to btw) #!/bin/sh python manage.py makemigrations python manage.py migrate python manage.py test exec "$@"

hoping someone can help with this thank you

tharanseriously avatar Mar 15 '23 09:03 tharanseriously

Haven't had that issue, \r is new line in bash, did you try to run the the "python manage.py makemigrations" manually? instead of using the shell script?

WulffenSec avatar Mar 16 '23 04:03 WulffenSec

Running the migration commands in the terminal should work. This is assuming, of course, that the container is running.

If the build fails, remove the migration commands from the entry point file but leave everything else.

If you have good eyes, you can use the terminal in docker desktop to run any Django management company I.e. python manage.py collectstatic

Another option is to enter the container via you text editor.

docker exec -it bash

🙌

bobby-didcoding avatar Mar 16 '23 07:03 bobby-didcoding

Hi all, I'm having the below error after running the docker build 2023-03-24 16:43:51 exec /code/docker/entrypoints/entrypoint.sh: no such file or directory

Any thoughts?

joedady16 avatar Mar 24 '23 23:03 joedady16

@joedady16 Does even exist "/backend/docker/entrypoints/entrypoint.sh" in your drf_course folder? if not git pull

WulffenSec avatar Mar 25 '23 11:03 WulffenSec

@WulffenSec yeah its in there. Kind of why i'm confused. I even did what the others did for their error with no change. My app runs but i get that error on my api

joedady16 avatar Mar 25 '23 17:03 joedady16

In addition to @WulffenSec 's solution to the Unknown command: 'makemigrations\r'. Did you mean makemigrations?... error, You can also edit your script to this #!/bin/sh python manage.py makemigrations && python manage.py migrate && python manage.py test && exec "$@"

3k3n3 avatar Mar 27 '23 12:03 3k3n3

@joedady16 , maybe try to give it the full path from root?

WulffenSec avatar Mar 28 '23 06:03 WulffenSec

@joedady16 I'm having the same issue; confirmed the directory I'm running docker-compose from is the main drf_course folder and I'm outside the venv, I deleted and rebuilt the Docker apps multiple times, still get the API error. @WulffenSec I also updated the /backend/docker/docker_files/Dockerfile prior to Docker build to have the full path from C: to the entrypoint.sh (within both the ENTRYPOINT brackets and after the chmod command), is this where you're referring to?

I'm only 1.5yrs into software dev and Docker is new to me, I'm sure I'm doing something wrong here. Very grateful for any help!

Allan1212 avatar Apr 07 '23 04:04 Allan1212

Hi mate.

Try changing the entrypoint line to:

CMD ['python','manage.py','makemigrations']

Hope this helps

bobby-didcoding avatar Apr 07 '23 05:04 bobby-didcoding

@bobby-didcoding you definitely made today a Good Friday as that cleared the error and got it to run, thank you very much! :)

Allan1212 avatar Apr 07 '23 22:04 Allan1212

Hi @WulffenSec im having another issue after replacing the code as you suggested.

2023-03-15 17:14:17 Unknown command: 'makemigrations\r'. Did you mean makemigrations? 2023-03-15 17:14:17 Type 'manage.py help' for usage.

Basically it's running the container but when it hits the entrypoint.sh file for some reason its running 'makemigrations\r' instead of just 'makemigrations'

here is what's in my entrypoint.sh(which I have not made a change to btw) #!/bin/sh python manage.py makemigrations python manage.py migrate python manage.py test exec "$@"

hoping someone can help with this thank you

Thank you @tharanseriously

jackielics avatar Sep 16 '23 06:09 jackielics