Docker - Файл есть (ls) но его нет. Как исправить? Почему так?
Вот такой скрипт - ENTRYPOINT в докер файле
#!/bin/bash
ls /venv/bin -lah
ls /venv/bin/python -lah
ls /venv/bin/python3 -lah
/venv/bin/python -V
/venv/bin/python manage.py migrate
/venv/bin/python manage.py runserver 0.0.0.0:8000
Причем вывод следущий
total 156K
2023-08-07T19:08:16.875178444Z drwxr-xr-x 1 root root 4.0K Aug 7 18:46 .
2023-08-07T19:08:16.875181260Z drwxr-xr-x 1 root root 4.0K Aug 7 18:46 ..
2023-08-07T19:08:16.875183624Z -rw-r--r-- 1 root root 8.9K Aug 7 17:58 Activate.ps1
2023-08-07T19:08:16.875185668Z drwxr-xr-x 2 root root 4.0K Aug 7 18:46 __pycache__
2023-08-07T19:08:16.875187592Z -rw-r--r-- 1 root root 2.0K Aug 7 17:58 activate
2023-08-07T19:08:16.875189515Z -rw-r--r-- 1 root root 898 Aug 7 17:58 activate.csh
2023-08-07T19:08:16.875191419Z -rw-r--r-- 1 root root 2.0K Aug 7 17:58 activate.fish
2023-08-07T19:08:16.875193342Z -rwxr-xr-x 1 root root 218 Aug 7 18:46 automat-visualize
2023-08-07T19:08:16.875195286Z -rwxr-xr-x 1 root root 215 Aug 7 18:46 celery
2023-08-07T19:08:16.875197170Z -rwxr-xr-x 1 root root 224 Aug 7 18:46 cftp
2023-08-07T19:08:16.875199073Z -rwxr-xr-x 1 root root 222 Aug 7 18:45 chardetect
2023-08-07T19:08:16.875200977Z -rwxr-xr-x 1 root root 227 Aug 7 18:46 ckeygen
2023-08-07T19:08:16.875202850Z -rwxr-xr-x 1 root root 225 Aug 7 18:46 conch
2023-08-07T19:08:16.875204744Z -rwxr-xr-x 1 root root 213 Aug 7 18:45 distro
2023-08-07T19:08:16.875206627Z -rwxr-xr-x 1 root root 264 Aug 7 18:46 django-admin
2023-08-07T19:08:16.875208531Z -rwxr-xr-x 1 root root 654 Aug 7 18:46 django-admin.py
2023-08-07T19:08:16.875210445Z -rwxr-xr-x 1 root root 251 Aug 7 18:46 faker
2023-08-07T19:08:16.875212318Z -rwxr-xr-x 1 root root 218 Aug 7 18:02 gunicorn
2023-08-07T19:08:16.875214202Z -rwxr-xr-x 1 root root 1.7K Aug 7 18:45 jp.py
2023-08-07T19:08:16.875216085Z -rwxr-xr-x 1 root root 227 Aug 7 18:46 mailmail
2023-08-07T19:08:16.875217959Z -rwxr-xr-x 1 root root 211 Aug 7 18:45 netaddr
2023-08-07T19:08:16.875219832Z -rwxr-xr-x 1 root root 245 Aug 7 18:45 normalizer
2023-08-07T19:08:16.875221726Z -rwxr-xr-x 1 root root 222 Aug 7 17:58 pip
2023-08-07T19:08:16.875223609Z -rwxr-xr-x 1 root root 222 Aug 7 17:58 pip3
2023-08-07T19:08:16.875225513Z -rwxr-xr-x 1 root root 222 Aug 7 17:58 pip3.10
2023-08-07T19:08:16.875227397Z -rwxr-xr-x 1 root root 222 Aug 7 17:58 pip3.11
2023-08-07T19:08:16.875229280Z -rwxr-xr-x 1 root root 222 Aug 7 18:46 py.test
2023-08-07T19:08:16.875231174Z -rwxr-xr-x 1 root root 222 Aug 7 18:46 pyhtmlizer
2023-08-07T19:08:16.875233057Z -rwxr-xr-x 1 root root 222 Aug 7 18:46 pytest
2023-08-07T19:08:16.875234941Z lrwxrwxrwx 1 root root 7 Aug 7 17:58 python -> python3
2023-08-07T19:08:16.875237115Z lrwxrwxrwx 1 root root 16 Aug 7 17:58 python3 -> /usr/bin/python3
2023-08-07T19:08:16.875239179Z lrwxrwxrwx 1 root root 7 Aug 7 17:58 python3.10 -> python3
2023-08-07T19:08:16.875242164Z -rwxr-xr-x 1 root root 220 Aug 7 18:46 scrapy
2023-08-07T19:08:16.875245000Z -rwxr-xr-x 1 root root 217 Aug 7 18:45 sqlformat
2023-08-07T19:08:16.875251121Z -rwxr-xr-x 1 root root 227 Aug 7 18:46 tkconch
2023-08-07T19:08:16.875253105Z -rwxr-xr-x 1 root root 214 Aug 7 18:46 tldextract
2023-08-07T19:08:16.875255009Z -rwxr-xr-x 1 root root 219 Aug 7 18:46 trial
2023-08-07T19:08:16.875256892Z -rwxr-xr-x 1 root root 239 Aug 7 18:46 twist
2023-08-07T19:08:16.875258796Z -rwxr-xr-x 1 root root 220 Aug 7 18:46 twistd
2023-08-07T19:08:16.875870648Z lrwxrwxrwx 1 root root 7 Aug 7 17:58 /venv/bin/python -> python3
2023-08-07T19:08:16.876523819Z lrwxrwxrwx 1 root root 16 Aug 7 17:58 /venv/bin/python3 -> /usr/bin/python3
2023-08-07T19:08:16.876807123Z ./docker-entrypoint.sh: line 5: /venv/bin/python: No such file or directory
2023-08-07T19:08:16.877094885Z ./docker-entrypoint.sh: line 6: /venv/bin/python: No such file or directory
2023-08-07T19:08:16.877353893Z ./docker-entrypoint.sh: line 7: /venv/bin/python: No such file or directory
Какая то непонятная хрень
Сам питон устанавливается
RUN apt-get -y update
RUN apt-get -y install apt-transport-https
RUN apt-get -y install bash
RUN apt-get -y install python3 python3-pip python3-venv python3-dev python3-setuptools
RUN apt-get -y install libtiff5-dev libjpeg8-dev libopenjp2-7-dev zlib1g-dev \
libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python3-tk \
libharfbuzz-dev libfribidi-dev libxcb1-dev
RUN apt-get -y install libpq-dev
RUN python3 --version
RUN python3 -m venv /venv
...
ADD docker/development/backend/docker-entrypoint.sh .
RUN cat docker-entrypoint.sh
# ADD docker/development/backend/docker-entrypoint.sh ./docker-entrypoint.sh
RUN chmod +x docker-entrypoint.sh
#RUN ls /usr/bin/python*
#CMD sh
#ENTRYPOINT [ "bash", "-e", "./docker-entrypoint.sh" ]
CMD ["./docker-entrypoint.sh"]
python3: /usr/lib/python3 /etc/python3 /usr/share/python3
2023-08-07T20:21:47.773728494Z ls: cannot access '/usr/bin/python*': No such file or directory
2023-08-07T20:21:47.775139503Z ./docker-entrypoint.sh: line 4: /venv/bin/python: No such file or directory
2023-08-07T20:21:47.775411994Z ./docker-entrypoint.sh: line 5: /venv/bin/python: No such file or directory
0.0s
=> ERROR [ 9/20] RUN ln -s /etc/python3 /usr/bin/python3 0.3s
------
> [ 9/20] RUN ln -s /etc/python3 /usr/bin/python3:
#0 0.230 ln: failed to create symbolic link '/usr/bin/python3': File exists
------
Dockerfile:18
Источник: Stack Overflow на русском