Как следует вызывать докер, чтобы решить проблему PID 1 с зомби-процессами?

Если я правильно вас понял, в каждом из ваших каталогов есть только один файл, и вы хотите переместить этот файл, если он есть в вашем списке. Если это так, вы можете сделать:

while read -r file; do cp sourcedir/*/"$file" targetdir; done < list.txt

Если вам также нужно скопировать каталоги, вы можете прочитать файлы, уберите расширение файла , чтобы получить имя каталога, и скопируйте его:

while read -r file; do cp -r sourcedir/"${file%.*}" targetdir; done < list.txt

1
08.05.2018, 05:04
2 ответа

docker tiene una opción --init. Eso inicia init system tini como Pid 1.

tinise almacena como /usr/bin/docker-initen el host. Desafortunadamente, algunos sistemas como fedora y openSUSE pierden el binario de inicio aunque --initaparece en docker run --help.

Puede agregar tinia sus imágenes acoplables usted mismo y definir el punto de entrada con ENTRYPOINT /tini --. Consulte LÉAME para tini .

Más información sobre la falta de /usr/bin/docker-initen:https://github.com/mviereck/x11docker/issues/23#issuecomment-386817295

1
27.01.2020, 23:43

Я понял(отсюда ), что правильный способ использования phusion/baseimage— запустить его как-

docker run --rm -t -i phusion/baseimage /sbin/my_init ps aux`

чтобы my_initвыполнялся как PID1 и чтобы my_initпорождал процесс дляps aux

*** Running /etc/my_init.d/00_regen_ssh_host_keys.sh...
*** Running /etc/my_init.d/10_syslog-ng.init...
May  8 04:18:23 daf3cfab8573 syslog-ng[10]: syslog-ng starting up; version='3.5.6'
May  8 04:18:23 daf3cfab8573 syslog-ng[10]: WARNING: you are using the pipe driver, underlying file is not a FIFO, it should be used by file(); filename='/dev/stdout'
May  8 04:18:24 daf3cfab8573 syslog-ng[10]: EOF on control channel, closing connection;
*** Running /etc/rc.local...
*** Booting runit daemon...
*** Runit started as PID 16
*** Running ps aux...
May  8 04:18:24 daf3cfab8573 cron[20]: (CRON) INFO (pidfile fd = 3)
May  8 04:18:24 daf3cfab8573 cron[20]: (CRON) INFO (Running @reboot jobs)
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  5.0  0.0  32304 10796 ?        Ss+  04:18   0:00 /usr/bin/python3 -u /sbin/my_init ps aux
root        10  1.0  0.0  72364  7552 ?        S    04:18   0:00 /usr/sbin/syslog-ng --pidfile /var/run/syslog-ng.pid -F --no-caps
root        16  0.0  0.0   4392  1124 ?        S+   04:18   0:00 /usr/bin/runsvdir -P /etc/service
root        17  0.0  0.0  37656  3340 ?        R+   04:18   0:00 ps aux
root        18  0.0  0.0   4240   672 ?        Ss   04:18   0:00 runsv cron
root        19  0.0  0.0   4240   800 ?        Ss   04:18   0:00 runsv sshd
root        20  0.0  0.0  29272  2840 ?        S    04:18   0:00 /usr/sbin/cron -f
*** ps exited with status 0.
*** Shutting down runit daemon (PID 16)...
*** Running /etc/my_init.post_shutdown.d/10_syslog-ng.shutdown...
May  8 04:18:24 daf3cfab8573 syslog-ng[10]: syslog-ng shutting down; version='3.5.6'
May  8 04:18:24 daf3cfab8573 syslog-ng[10]: EOF on control channel, closing connection;
*** Killing all processes...
0
27.01.2020, 23:43

Теги

Похожие вопросы