Bonjour à tous 🙂

Cela fait déjà un moment que je regarde mondedie (sans me connecter) et cela m'a souvent aidé... Cependant, certain problème sont difficile à résoudre sans aide, c'est pour ça que je me tourne vers vous ^^
J'ai suivis le tutoriel de @xataz sur "Commenter créer un Dockerfile", jusque la, pas de soucis, mais maintenant j'en ai un, soucis à l'execution, le fichier start se lance, mais en partie, c'est à dire qu'il ne remplace pas certaine valeurs par les variables d'environnement :/
Voici le fichier Dockerfile et start.sh incriminé 😉

FROM python:3.4.5-alpine
MAINTAINER Dryusdan <contact@dryusdan.fr>
ENV UID=991 GID=991 \
SECRET_KEY=ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789 \
SALT=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz123456789 \
MAIL_SERVER= \
MAIL_PORT=465 \
MAIL_USERNAME= \
MAIL_PASSWORD= \
MAIL_TLS=false \
MAIL_SSL=true \
REDIS_URL=localhost \
REDIS_PORT=6379 \
MEMCACHED_SERVER=127.0.0.1:11211 

RUN mkdir /Onyx \
&& BUILD_DEPS=" \
build-base \
cyrus-sasl-dev \
linux-headers \
libsasl \
libssl1.0 \
openssl-dev \
zlib-dev \
libffi \
python3-dev \
libmemcached-dev " \
&& apk --update add \
${BUILD_DEPS} \
su-exec \
curl \
git \
nodejs \
memcached  \
openssl  \
&& apk add --virtual python-software-properties \
&& pip3 install psutil python-memcached virtualenv setuptools pylibmc \
&& git clone https://github.com/OnyxProject/Onyx.git /Onyx && cd /Onyx/ && chmod +x launch.sh \
&& pip3 install -r requirements.txt \
&& cd /Onyx/ && make \
&& apk del ${BUILD_DEPS} \
&& rm -rf /var/cache/apk/* /tmp/* /root/.gnupg /root/.cache/ 

WORKDIR /Onyx/

ADD config.py onyx/config.py
ADD start.sh start.sh

RUN chmod +x start.sh # && chown -R $UID:$GID /Onyx/

VOLUME /Onyx/data
EXPOSE 80
CMD ["./start.sh"]    


#!/bin/sh

sed -i -e 's|<secret_key>|'${SECRET_KEY}'|' \
    -e 's|<salt>|'${SALT}'|' \
    -e 's|<mail_server>|'${MAIL_SERVER}'|' \
    -e 's|<mail_port>|'${MAIL_PORT}'|' \
    -e 's|<mail_username>|'${MAIL_USERNAME}'|' \
    -e 's|<mail_password>|'${MAIL_PASSWORD}'|' \
    -e 's|<mail_tls>|'${MAIL_TLS}'|' \
    -e 's|<mail_ssl>|'${MAIL_SSL}'|' \
    -e 's|<redis_url>|'${REDIS_URL}'|' \
    -e 's|<redis_port>|'${REDIS_PORT}'|' \
    -e 's|<mecached_server>|'${MEMCACHED_SERVER}'|' /Onyx/onyx/config.py
	
chown -R ${UID}:${GID} /Onyx/
exec su-exec 991:991 python3 manage.py runserver -h 0.0.0.0 -p 80 -d -r   

Merci d'avance pour votre aide 🙂

EDIT : >Lorsque je démarre le conteneur juste pour afficher le contenu du dossier avec les droits, il me renvoie ça :

drwxr-xr-x 8 root root 4096 Dec 27 18:28 .
drwxr-xr-x 19 root root 4096 Dec 27 18:28 ..
drwxr-xr-x 8 root root 152 Dec 27 15:50 .git
-rw-r--r-- 1 root root 222 Dec 27 15:50 .gitignore
-rw-r--r-- 1 root root 226 Dec 27 15:50 .travis.yml
-rw-r--r-- 1 root root 183 Dec 27 15:50 Dockerfile
-rw-r--r-- 1 root root 2153 Dec 27 15:50 LICENSE.txt
-rw-r--r-- 1 root root 358 Dec 27 15:50 MANIFEST.in
-rw-r--r-- 1 root root 1645 Dec 27 15:50 Makefile
-rw-r--r-- 1 root root 1629 Dec 27 15:50 README.md
-rw-r--r-- 1 root root 1024 Dec 27 15:50 README.rst
-rw-r--r-- 1 root root 1099 Dec 27 15:50 init.py
-rw-r--r-- 1 root root 178 Dec 27 15:50 apidoc.json
-rw-r--r-- 1 root root 121 Dec 27 15:50 babel.cfg
drwxr-xr-x 2 991 991 4096 Dec 24 15:18 data
drwxr-xr-x 7 root root 4096 Dec 27 15:50 doc
-rw-r--r-- 1 root root 111 Dec 27 15:50 entry.py
-rw-r--r-- 1 root root 435 Dec 27 15:50 install.sh
-rw-r--r-- 1 root root 414 Dec 27 15:50 install_travis.sh
-rwxr-xr-x 1 root root 64 Dec 27 15:50 launch.sh
-rw-r--r-- 1 root root 100 Dec 27 15:50 launchUbuntu.sh
-rw-r--r-- 1 root root 527 Dec 27 15:50 local.cfg
-rw-r--r-- 1 root root 519 Dec 27 15:50 manage.py
drwxr-xr-x 9 root root 4096 Dec 27 16:05 onyx
-rw-r--r-- 1 root root 227 Dec 27 15:50 packages.txt
-rw-r--r-- 1 root root 472 Dec 27 15:50 requirements.txt
-rw-r--r-- 1 root root 64 Dec 27 15:50 run.sh
-rw-r--r-- 1 root root 111 Dec 27 15:50 run_travis.sh
-rw-r--r-- 1 root root 37 Dec 27 15:50 run_vps.sh
-rwxr-xr-x 1 root root 653 Dec 27 18:22 start.sh
drwxr-xr-x 7 root root 60 Dec 27 15:50 static
drwxr-xr-x 5 root root 65 Dec 27 15:55 venv

et si tu essaye de fair e toi même le chmod dans le conteneur via exec, ca passe ?
si oui essaye de rebuild, si non une erreur d'affichée ?

Salut
je connais pas grand chose et si tu modifie

exec su-exec 991:991 python3 manage.py runserver -h 0.0.0.0 -p 80 -d -r  
par
exec su-exec $UID:$GID python3 manage.py runserver -h 0.0.0.0 -p 80 -d -r  

Cela reste en route sauf le dossier /Onyx/data qui passe en 991:991 (enfin avant, la j'ai exec qui fonctionne plus, ça va me poser un soucis ^^'

EDIT : oups, j'ai oublié de modifier le docker run ^^

EDIT 2 : retour a la case départ : permission denied car tout est en root:root sauf /Onyx/data

Dryusdan fait docker exec -ti tonconteneur /bin/sh

Et ensuite le Chmod puis CTRL+d pour sortir du conteneur.

Fait, je qu'est ce que je fais maintenant ?
(Dès que je quitte le container crash :/ )

Dryusdan perso en ce moment j ai pas le temps de voir mais si tu as une semaine à attendre je verrais dès que possible

    @Dryusdan Tu pourrais mettre tout tes fichiers sur github, que l'on puisse tester ?

      xataz J'ai mon gitlab 😉 (3 secondes que je mette à jour le dépot 😉 )
      https://git.dryusdan.fr/Dryusdan/Dockerfiles/tree/master/onyxproject

      EDIT: répertoire mis à jour 😉

      EDIT 2 : PS: il y a moyen de te contacter en privée ? C'est à propos d'une de tes Dockerfiles qui ne démarre pas et qui a un bug de compilation ^^' (rtorrent)

      EDIT 3 : Compilation réussi ! J'ai refait comme le conseillait @arckosfr en faisant passer le chmod par exec Soucis : le container ne reste pas lancé, il se coupe instantanément
      Soucis numéro 2 : tout est en root sauf data/ (encore)
      Donc je continue de débuger mais merci pour cette aide 😃

      EDIT 8978141 (alias 4) :
      Repository mis à jour pour le debbuging ^^ (j'ai mis des logs dans le fichier start.sh)
      Le chown fonctionne, le problème vient du exec, précisément : de cette partie :

      File "/usr/local/lib/python3.4/site-packages/werkzeug/serving.py", line 677, in run_simple
      s.bind((hostname, port))
      PermissionError: [Errno 13] Permission denied

      J'imagine donc que le problème vient du bind non ?

      Tu as essayer de l'installer via pipy plutot que via leurs github ? (comme conseillé)

      J'ai essayé, et ça affichait la même erreur 😛
      Bon, ça avance, le problème était que l'utilisateur 991 n'a pas à toucher au port 80 ^^ donc c'est modifié 😉
      Donc ça boot, (je met le dépot à jour) sauf que : problème d'utilisateur 🙁

      File "/usr/local/lib/python3.4/getpass.py", line 170, in getuser
      return pwd.getpwuid(os.getuid())[0]
      KeyError: 'getpwuid(): uid not found: 991'

      Et la part contre, j'ai pas encore de connaissance suffisante sur les utilisateurs Linux 😢
      Une idée 🙂

      J'ai remplacé le démarrage le port de démarrage de l'appli, c'est passé de 80 a 5080 donc j'ai fais un Expose sur le port 5080 😉

      J'ai pas encore testé, mais je pense que tu vas avoir deux problèmes :
      - Le port 80 ne passera pas, car il ne peux être utilisé que par root.
      - Certaines applications ne permettent pas d'être lancé que par un UID, il faut créé un user pour ce faire.

      Donc dans ton startup.sh, ce serais plutôt :

      #!/bin/sh
      
      addgroup -g ${GID} onyx && adduser -h /home/onyx -s /bin/sh -G onyx -u ${UID} -D onyx
      
      sed -i -e 's|<secret_key>|'${SECRET_KEY}'|' \
          -e 's|<salt>|'${SALT}'|' \
          -e 's|<mail_server>|'${MAIL_SERVER}'|' \
          -e 's|<mail_port>|'${MAIL_PORT}'|' \
          -e 's|<mail_username>|'${MAIL_USERNAME}'|' \
          -e 's|<mail_password>|'${MAIL_PASSWORD}'|' \
          -e 's|<mail_tls>|'${MAIL_TLS}'|' \
          -e 's|<mail_ssl>|'${MAIL_SSL}'|' \
          -e 's|<redis_url>|'${REDIS_URL}'|' \
          -e 's|<redis_port>|'${REDIS_PORT}'|' \
          -e 's|<mecached_server>|'${MEMCACHED_SERVER}'|' /Onyx/onyx/config.py
      	
      chown -R ${UID}:${GID} /Onyx/
      exec su-exec onyx:onyx python3 manage.py runserver -h 0.0.0.0 -p 8080 -d -r   

      Je check ca dans quelques minutes 😊
      Merci 🙂

      EDIT: Le problème du port 80 est réglé _

      J'ai pu le lancer sur mon PC, ça semble fonctionner (accès à la webUI), mais j'ai pas cherché plus loin

      Dockerfile :

      FROM python:3.4.5-alpine
      MAINTAINER Dryusdan <contact@dryusdan.fr>
      ENV UID=991 GID=991 \
              SECRET_KEY=ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789 \
              SALT=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz123456789 \
              MAIL_SERVER= \
              MAIL_PORT=465 \
              MAIL_USERNAME= \
              MAIL_PASSWORD= \
              MAIL_TLS=false \
              MAIL_SSL=true \
              REDIS_URL=localhost \
              REDIS_PORT=6379 \
              MEMCACHED_SERVER=127.0.0.1:11211
      
      RUN mkdir /Onyx \
              && BUILD_DEPS=" \
          build-base \
          cyrus-sasl-dev \
              linux-headers \
              libsasl \
              libssl1.0 \
              openssl-dev \
              zlib-dev \
              libffi \
              python3-dev \
              libmemcached-dev " \
              && apk --update add \
              ${BUILD_DEPS} \
              su-exec \
              curl \
              git \
              nodejs \
              memcached  \
              openssl  \
              && apk add --virtual python-software-properties \
              && pip3 install psutil python-memcached virtualenv setuptools pylibmc \
              && git clone https://github.com/OnyxProject/Onyx.git /Onyx && cd /Onyx/ && chmod +x launch.sh \
              && pip3 install -r requirements.txt \
              && cd /Onyx/ && make \
              && apk del ${BUILD_DEPS} \
              && rm -rf /var/cache/apk/* /tmp/* /root/.gnupg /root/.cache/ /Onyx/.git
      
      WORKDIR /Onyx/
      
      ADD config.py onyx/config.py
      ADD start.sh start.sh
      
      RUN chmod +x start.sh # && chown -R $UID:$GID /Onyx/
      
      VOLUME /Onyx/data
      EXPOSE 5080
      ENTRYPOINT ["./start.sh"]
      CMD ["python3", "manage.py", "runserver", "-h", "0.0.0.0", "-p", "5080", "-d", "-r"]

      start.sh :

      #!/bin/sh
      
      addgroup -g ${GID} onyx && adduser -h /home/onyx -s /bin/sh -G onyx -u ${UID} -D onyx
      
      sed -i -e 's|<secret_key>|'${SECRET_KEY}'|' \
              -e 's|<salt>|'${SALT}'|' \
              -e 's|<mail_server>|'${MAIL_SERVER}'|' \
              -e 's|<mail_port>|'${MAIL_PORT}'|' \
              -e 's|<mail_username>|'${MAIL_USERNAME}'|' \
              -e 's|<mail_password>|'${MAIL_PASSWORD}'|' \
              -e 's|<mail_tls>|'${MAIL_TLS}'|' \
              -e 's|<mail_ssl>|'${MAIL_SSL}'|' \
              -e 's|<redis_url>|'${REDIS_URL}'|' \
              -e 's|<redis_port>|'${REDIS_PORT}'|' \
              -e 's|<mecached_server>|'${MEMCACHED_SERVER}'|' /Onyx/onyx/config.py
      chown -R $UID:$GID ./
      
      if [ $# -eq 0 ]; then
          exec su-exec onyx:onyx python3 manage.py runserver -h 0.0.0.0 -p 5080 -d -r
      else
          exec su-exec onyx:onyx $@
      fi

      Et comme tu peux voir, les droits sont ok :

      $ winpty docker run -ti -p 5080:5080 xataz/onyx ls -l
      total 108
      -rw-r--r--    1 onyx     onyx           183 Dec 29 12:13 Dockerfile
      -rwxr-xr-x    1 onyx     onyx          2153 Dec 29 12:13 LICENSE.txt
      -rw-r--r--    1 onyx     onyx           358 Dec 29 12:13 MANIFEST.in
      -rw-r--r--    1 onyx     onyx          1645 Dec 29 12:13 Makefile
      -rw-r--r--    1 onyx     onyx          1629 Dec 29 12:13 README.md
      -rwxr-xr-x    1 onyx     onyx          1024 Dec 29 12:13 README.rst
      -rw-r--r--    1 onyx     onyx          1099 Dec 29 12:13 __init__.py
      -rw-r--r--    1 onyx     onyx           178 Dec 29 12:13 apidoc.json
      -rwxr-xr-x    1 onyx     onyx           121 Dec 29 12:13 babel.cfg
      drwxr-xr-x    2 onyx     onyx          4096 Dec 29 12:25 data
      drwxr-xr-x   12 onyx     onyx          4096 Dec 29 12:25 doc
      -rwxr-xr-x    1 onyx     onyx           111 Dec 29 12:13 entry.py
      -rw-r--r--    1 onyx     onyx           435 Dec 29 12:13 install.sh
      -rw-r--r--    1 onyx     onyx           414 Dec 29 12:13 install_travis.sh
      -rwxr-xr-x    1 onyx     onyx            64 Dec 29 12:13 launch.sh
      -rw-r--r--    1 onyx     onyx           100 Dec 29 12:13 launchUbuntu.sh
      -rwxr-xr-x    1 onyx     onyx           527 Dec 29 12:13 local.cfg
      -rwxr-xr-x    1 onyx     onyx           520 Dec 29 12:13 manage.py
      drwxr-xr-x   18 onyx     onyx          4096 Dec 29 12:25 onyx
      -rwxr-xr-x    1 onyx     onyx           227 Dec 29 12:13 packages.txt
      -rwxr-xr-x    1 onyx     onyx           472 Dec 29 12:13 requirements.txt
      -rw-r--r--    1 onyx     onyx            64 Dec 29 12:13 run.sh
      -rw-r--r--    1 onyx     onyx           111 Dec 29 12:13 run_travis.sh
      -rwxr-xr-x    1 onyx     onyx            37 Dec 29 12:13 run_vps.sh
      -rwxr-xr-x    1 onyx     onyx           797 Dec 29 12:19 start.sh
      drwxr-xr-x   12 onyx     onyx          4096 Dec 29 12:25 static
      drwxr-xr-x    8 onyx     onyx          4096 Dec 29 12:25 venv

      Après comme dit, ne connaissant pas du tout l'appli, je n'ai pas testé plus.

      C'est ton start.sh qui a fait le boulot o/
      Merci beaucoup 🙂

      Attends voir, c'est quoi la différence entre CMD et ENTRYPOINT ? o.O
      et cette ligne la :
      if [ $# -eq 0 ]; then
      exec su-exec onyx:onyx python3 manage.py runserver -h 0.0.0.0 -p 5080 -d -r
      else
      exec su-exec onyx:onyx $@
      fi

      ? Tu m'as déjà perdu ^^