Ho un contenitore di finestra mobile con alcuni processi (uwsgi e sedano) in esecuzione all'interno. Voglio creare un utente di sedici e un utente uwsgi per questi processi e un gruppo di lavoro a cui entrambi appartengano, al fine di assegnare le autorizzazioni.Aggiungi utente al contenitore mobile
Ho provato ad aggiungere RUN adduser uwsgi
e RUN adduser celery
al mio Dockerfile, ma questo sta causando problemi, dal momento che questi comandi richiedono l'input (ho postato le risposte dalla compilazione di seguito).
Qual è il modo migliore per aggiungere utenti a un contenitore Docker in modo da impostare le autorizzazioni per i lavoratori in esecuzione nel contenitore?
L'immagine di Docker è stata creata dalla base ufficiale di Ubuntu14.04.
Ecco l'output del Dockerfile quando i comandi vengono eseguiti adduser:
Adding user `uwsgi' ...
Adding new group `uwsgi' (1000) ...
Adding new user `uwsgi' (1000) with group `uwsgi' ...
Creating home directory `/home/uwsgi' ...
Copying files from `/etc/skel' ...
[91mEnter new UNIX password: Retype new UNIX password: [0m
[91mpasswd: Authentication token manipulation error
passwd: password unchanged
[0m
[91mUse of uninitialized value $answer in chop at /usr/sbin/adduser line 563.
[0m
[91mUse of uninitialized value $answer in pattern match (m//) at /usr/sbin/adduser line 564.
[0m
Try again? [y/N]
Changing the user information for uwsgi
Enter the new value, or press ENTER for the default
Full Name []:
Room Number []: Work Phone []: Home Phone []: Other []:
[91mUse of uninitialized value $answer in chop at /usr/sbin/adduser line 589.
[0m
[91mUse of uninitialized value $answer in pattern match (m//) at /usr/sbin/adduser line 590.
[0m
Is the information correct? [Y/n]
---> 258f2f2f13df
Removing intermediate container 59948863162a
Step 5 : RUN adduser celery
---> Running in be06f1e20f64
Adding user `celery' ...
Adding new group `celery' (1001) ...
Adding new user `celery' (1001) with group `celery' ...
Creating home directory `/home/celery' ...
Copying files from `/etc/skel' ...
[91mEnter new UNIX password: Retype new UNIX password: [0m
[91mpasswd: Authentication token manipulation error
passwd: password unchanged
[0m
[91mUse of uninitialized value $answer in chop at /usr/sbin/adduser line 563.
[0m
[91mUse of uninitialized value $answer in pattern match (m//) at /usr/sbin/adduser line 564.
[0m
Try again? [y/N]
Changing the user information for celery
Enter the new value, or press ENTER for the default
Full Name []: Room Number []: Work Phone []:
Home Phone []: Other []:
[91mUse of uninitialized value $answer in chop at /usr/sbin/adduser line 589.
[0m
[91mUse of uninitialized value $answer in pattern match (m//) at /usr/sbin/adduser line 590.
[0m
Is the information correct? [Y/n]
è 'newuser' il nome dell'utente che tu stesso potrai scegliere? –
Sì, esattamente. Sostituiscilo con un nome a tua scelta. –
Ti consiglio di utilizzare le opzioni complete di nome in un Dockerfile, come in uno script, anziché in quelle brevi (più da utilizzare se usato in modo interattivo IMO). 'useradd --create-home --shell/bin/bash' è più comprensibile/leggibile per i colleghi. –