应用程序是否在 docker 容器内部运行,应该出现在主机顶部输出和 ps -ef 输出中?

应用程序是否在 docker 容器内部运行,应该出现在主机顶部输出和 ps -ef 输出中?

我刚刚将我的docker升级到

Docker version 19.03.2, build 6a30dfc

但是,我注意到,当我top在 Ubuntu 主机中运行命令时,我得到了以下输出。我不希望当前在我的 docker 容器内运行的某些应用程序出现在主机top输出中。

例如,像gunicornceleryredis-serverpostgres这样的应用程序traefik应该在 docker 容器中运行。我的主机没有安装或运行其中任何一个。

顶部

root@xxx:~# top
top - 16:26:05 up  1:57,  1 user,  load average: 2.80, 0.95, 0.51
Tasks: 425 total,   1 running, 424 sleeping,   0 stopped,   0 zombie
%Cpu(s): 59.1 us,  6.6 sy,  0.0 ni, 32.1 id,  0.0 wa,  0.0 hi,  2.0 si,  0.2 st
KiB Mem :  4046316 total,   145708 free,  2309116 used,  1591492 buff/cache
KiB Swap:        0 total,        0 free,        0 used.  1071112 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
26749 root      20   0  135612  39036   6432 S  63.6  1.0   0:16.22 gunicorn
 2113 do-agent  20   0 2731444  90288   6108 S  39.4  2.2   1:43.60 beam.smp
15485 root      20   0  130248  40448   5292 S   7.3  1.0   1:11.49 celery
 9581 root      20   0 2157968  72680   4104 S   5.0  1.8   1:47.64 dockerd
 5140 do-agent  20   0 2755948 110480   6332 S   3.3  2.7   3:15.68 beam.smp
 1679 root      20   0  108756   5864   4832 S   1.3  0.1   0:02.38 containerd-shim
15434 do-agent  20   0 2745196  99188   6480 S   1.0  2.5   1:01.54 beam.smp
    7 root      20   0       0      0      0 S   0.7  0.0   0:17.38 rcu_sched
 7697 root      20   0  123644  36316   7812 S   0.7  0.9   0:27.48 celery
 7736 root      20   0  119428  32192   7924 S   0.7  0.8   0:27.12 celery
 7806 root      20   0  119464  32204   7964 S   0.7  0.8   0:27.38 celery
 7826 root      20   0  183480  46496  11304 S   0.7  1.1   0:30.19 celery
 8064 root      20   0  119328  32224   7968 S   0.7  0.8   0:31.32 celery
 8408 root      20   0  119336  32064   7888 S   0.7  0.8   0:30.74 celery
 8447 root      20   0  119336  31984   7800 S   0.7  0.8   0:31.60 celery
 8481 root      20   0  119328  31996   7736 S   0.7  0.8   0:31.00 celery
15119 root      20   0  127820  40364   7800 S   0.7  1.0   0:17.77 celery
15184 root      20   0  135764  44956   7864 S   0.7  1.1   0:14.44 celery
29750 root      20   0  125308  35844   7688 S   0.7  0.9   1:23.06 gunicorn
 1462 root      20   0 1846212  36140   5064 S   0.3  0.9   0:18.90 containerd
 3689 do-agent  20   0   11428    916    816 S   0.3  0.0   0:00.39 inet_gethost
 3690 do-agent  20   0   13548   1516   1376 S   0.3  0.0   0:00.57 inet_gethost
 7578 root      20   0  119460  32120   7684 S   0.3  0.8   0:27.76 celery
 7635 root      20   0  108756   2472   1420 S   0.3  0.1   0:00.27 containerd-shim
 8991 do-agent  20   0   41520  12760   2996 S   0.3  0.3   0:06.08 redis-server
 9173 do-agent  20   0  288256   8500   6788 S   0.3  0.2   0:00.46 postgres
11536 root      20   0  132768  41372   7860 S   0.3  1.0   0:13.17 celery
11602 root      20   0  120336  32800   7716 S   0.3  0.8   0:15.30 celery
11636 root      20   0  119524  32148   7776 S   0.3  0.8   0:10.54 celery
12299 do-agent  20   0 2745200  97036   6224 S   0.3  2.4   0:57.04 beam.smp
12472 do-agent  20   0  288256   8628   6912 S   0.3  0.2   0:01.59 postgres
15243 root      20   0  123740  36400   7912 S   0.3  0.9   0:11.02 celery
16082 root      20   0  172020  65276  37848 S   0.3  1.6   0:46.96 traefik
17242 root      20   0  129012  36164   6460 S   0.3  0.9   0:07.53 gunicorn
28114 do-agent  20   0  291424  39476  36836 S   0.3  1.0   0:00.66 postgres
31700 root      20   0   40808   3976   3068 R   0.3  0.1   0:02.15 top
32388 root      20   0  138096  38916   6600 S   0.3  1.0   0:00.56 gunicorn

如果我ps -ef在主机上执行,那些应该在 docker 容器中运行的命令会出现在我的主机上吗?

ps-ef

root@xxx:~# ps -ef
...
do-agent   894   776  0 14:44 ?        00:00:00 postgres -c port=5432 -c logging_collector=on -c log_destination=stderr -c log_directory=/postgres_logs
do-agent   904   841  0 14:44 ?        00:00:07 redis-server *:6379
do-agent   910   829  0 14:44 ?        00:00:00 postgres -c port=5432 -c logging_collector=on -c log_destination=stderr -c log_directory=/postgres_logs
systemd+   940     1  0 14:29 ?        00:00:00 /lib/systemd/systemd-timesyncd
do-agent  1093   894  0 14:44 ?        00:00:00 postgres: logger process
do-agent  1095   894  0 14:44 ?        00:00:00 postgres: checkpointer process
do-agent  1096   894  0 14:44 ?        00:00:00 postgres: writer process
do-agent  1097   894  0 14:44 ?        00:00:00 postgres: wal writer process
do-agent  1098   894  0 14:44 ?        00:00:00 postgres: autovacuum launcher process
do-agent  1099   894  0 14:44 ?        00:00:00 postgres: stats collector process
do-agent  1100   894  0 14:44 ?        00:00:00 postgres: bgworker: logical replication launcher
do-agent  1179   910  0 14:44 ?        00:00:00 postgres: logger process
do-agent  1182   910  0 14:44 ?        00:00:00 postgres: checkpointer process
do-agent  1183   910  0 14:44 ?        00:00:00 postgres: writer process
do-agent  1184   910  0 14:44 ?        00:00:00 postgres: wal writer process
do-agent  1186   910  0 14:44 ?        00:00:00 postgres: autovacuum launcher process
do-agent  1187   910  0 14:44 ?        00:00:00 postgres: stats collector process
do-agent  1188   910  0 14:44 ?        00:00:00 postgres: bgworker: logical replication launcher
root      1268  1462  0 14:44 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/c445df454810
1000      1286  1268  0 14:44 ?        00:00:03 /pgbouncer/bin/pgbouncer -u pgbouncer /etc/pgbouncer/pgbouncer.ini
root      1339     2  0 14:29 ?        00:00:00 [kworker/1:1H]
root      1386     1  0 14:29 ?        00:00:00 /sbin/iscsid
root      1387     1  0 14:29 ?        00:00:01 /sbin/iscsid
syslog    1391     1  0 14:29 ?        00:00:00 /usr/sbin/rsyslogd -n
root      1394     1  0 14:29 ?        00:00:00 /usr/sbin/acpid
do-agent  1397     1  0 14:29 ?        00:00:09 /opt/digitalocean/bin/do-agent --syslog
root      1403     1  0 14:29 ?        00:00:00 /lib/systemd/systemd-logind
root      1410     1  0 14:29 ?        00:00:00 /usr/lib/accountsservice/accounts-daemon
root      1425     1  0 14:29 ?        00:00:00 /usr/bin/lxcfs /var/lib/lxcfs/
root      1427     1  0 14:29 ?        00:00:00 /usr/sbin/cron -f
daemon    1439     1  0 14:29 ?        00:00:00 /usr/sbin/atd -f
message+  1443     1  0 14:29 ?        00:00:03 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
root      1462     1  0 14:29 ?        00:00:19 /usr/bin/containerd
root      1464     1  0 14:29 ?        00:00:00 /usr/sbin/sshd -D
root      1501     1  0 14:29 ?        00:00:00 /sbin/mdadm --monitor --pid-file /run/mdadm/monitor.pid --daemonise --scan --syslog
root      1507     1  0 14:29 ?        00:00:00 /usr/bin/python3 /usr/share/unattended-upgrades/unattended-upgrade-shutdown --wait-for-signal
root      1513     1  0 14:29 ?        00:00:00 /usr/lib/policykit-1/polkitd --no-debug
root      1575     1  0 14:29 ?        00:00:00 /usr/sbin/irqbalance --pid=/var/run/irqbalance.pid
root      1593     1  0 14:29 tty1     00:00:00 /sbin/agetty --noclear tty1 linux
root      1597     1  0 14:29 ttyS0    00:00:00 /sbin/agetty --keep-baud 115200 38400 9600 ttyS0 vt220
root      1679  1462  0 14:44 ?        00:00:02 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/b6b5e6c7ea4a
do-agent  1705  1679  0 14:44 ?        00:00:00 /bin/sh /usr/lib/rabbitmq/bin/rabbitmq-server
do-agent  1949  1705  0 14:44 ?        00:00:00 /usr/lib/erlang/erts-9.2/bin/epmd -daemon
do-agent  2113  1705  1 14:44 ?        00:01:49 /usr/lib/erlang/erts-9.2/bin/beam.smp -W w -A 64 -P 1048576 -t 5000000 -stbt db -zdbbl 128000 -K true -B i --
do-agent  2221  2113  0 14:44 ?        00:00:00 erl_child_setup 1048576
root      2477  1462  0 14:44 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/a4c58a1456ff
root      2504  2477  0 14:44 ?        00:00:00 /usr/sbin/crond -f -l 8
root      2556  1462  0 14:44 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/385b2ea73ffc
root      2596  1462  0 14:44 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/529dd0965b60
root      2643  1462  0 14:44 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/06943c9f051f
root      2674  2556  0 14:44 ?        00:00:00 /bin/sh /insider_crawler/entry.sh
root      2694  2596  0 14:44 ?        00:00:00 /bin/sh -c /usr/local/bin/gunicorn main:app -b flask:5000 --error-logfile=/var/log/gunicorn3.err.log
root      2724  2643  0 14:44 ?        00:00:00 /bin/sh -c /usr/local/bin/gunicorn web.wsgi:application -b django:5000 --log-level=info --error-logfile=/var/
root      2982  1462  0 14:44 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/de0633b53cbc
root      3025  2982  0 14:44 ?        00:00:00 /bin/sh -c celery -A api_logging worker -Q api_logging -l INFO --config=celeryconfig
root      3035  2674  0 14:44 ?        00:00:00 /usr/sbin/crond -f -l 8
root      3057  2694  0 14:44 ?        00:00:01 /usr/local/bin/python /usr/local/bin/gunicorn main:app -b flask:5000 --error-logfile=/var/log/gunicorn3.err.l
root      3158  1462  0 14:44 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/502ad6a0e1e3
root      3223  3158  0 14:44 ?        00:00:00 nginx: master process nginx -g daemon off;
root      3246  3025  0 14:44 ?        00:00:07 /usr/local/bin/python /usr/local/bin/celery -A api_logging worker -Q api_logging -l INFO --config=celeryconfi
systemd+  3341  3223  0 14:44 ?        00:00:00 nginx: worker process
root      3351  3246  0 14:44 ?        00:00:00 /usr/local/bin/python /usr/local/bin/celery -A api_logging worker -Q api_logging -l INFO --config=celeryconfi
root      3356  3246  0 14:44 ?        00:00:00 /usr/local/bin/python /usr/local/bin/celery -A api_logging worker -Q api_logging -l INFO --config=celeryconfi
root      3456  1462  0 14:29 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/9c8ab5253b00
do-agent  3689  2221  0 14:44 ?        00:00:00 inet_gethost 4
do-agent  3690  3689  0 14:44 ?        00:00:00 inet_gethost 4
root      3952  1462  0 14:44 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/b9690166e4ea
do-agent  3982  3952  0 14:44 ?        00:00:00 /bin/sh /usr/lib/rabbitmq/bin/rabbitmq-server
root      3993  2724  0 14:44 ?        00:00:01 /usr/local/bin/python /usr/local/bin/gunicorn web.wsgi:application -b django:5000 --log-level=info --error-lo
root      4031  3993  0 14:44 ?        00:00:00 /usr/local/bin/python /usr/local/bin/gunicorn web.wsgi:application -b django:5000 --log-level=info --error-lo
root      4323  1462  0 14:45 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/a21e1862fa63
do-agent  4354  4323  0 14:45 ?        00:00:06 postgres -c logging_collector=on -c log_destination=stderr -c log_directory=/postgres_logs
do-agent  4408  3982  0 14:45 ?        00:00:00 /usr/lib/erlang/erts-9.2/bin/epmd -daemon
do-agent  4487  4354  0 14:45 ?        00:00:00 postgres: logger process
do-agent  4508  4354  0 14:45 ?        00:00:00 postgres: checkpointer process
do-agent  4509  4354  0 14:45 ?        00:00:00 postgres: writer process
do-agent  4510  4354  0 14:45 ?        00:00:00 postgres: wal writer process
do-agent  4511  4354  0 14:45 ?        00:00:00 postgres: autovacuum launcher process
do-agent  4512  4354  0 14:45 ?        00:00:02 postgres: stats collector process
do-agent  4513  4354  0 14:45 ?        00:00:00 postgres: bgworker: logical replication launcher
root      4576  1462  0 14:29 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/bdf5a9aa5327
root      4597  1462  0 14:45 ?        00:00:03 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/cda941c9b957
1000      4636  4597  0 14:45 ?        00:00:17 /pgbouncer/bin/pgbouncer -u pgbouncer /etc/pgbouncer/pgbouncer.ini
root      4851  1462  0 14:29 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/970acb888bca
root      4922  1462  0 14:29 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/79a21d2347cf
do-agent  5140  3982  3 14:45 ?        00:03:22 /usr/lib/erlang/erts-9.2/bin/beam.smp -W w -A 64 -P 1048576 -t 5000000 -stbt db -zdbbl 128000 -K true -B i --
root      5275  1462  0 14:45 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/6d78863470d2
root      5320  1462  0 14:29 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/4b52c897a07e
root      5323  5275  0 14:45 ?        00:00:01 /usr/local/bin/python /usr/local/bin/celery -A after_market_closed beat -l INFO --config=celeryconfig
root      5347  1462  0 14:45 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/58bc2f31e2aa
root      5500  5347  0 14:45 ?        00:00:01 /usr/local/bin/python /usr/local/bin/celery -A news beat -l INFO --config=celeryconfig
do-agent  5650  5140  0 14:45 ?        00:00:00 erl_child_setup 1048576
root      5983  1462  0 14:45 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/85f8f13c0e75
root      6009  5983  0 14:45 ?        00:00:00 /bin/sh -c /usr/local/bin/gunicorn main:app -b flask:5000 --log-level=info --error-logfile=/var/log/gunicorn3
root      6014  1462  0 14:29 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/fecefbdef928
root      6257  1462  0 14:45 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/126ff830be74
root      6282  6257  0 14:45 ?        00:00:00 /bin/sh ./entrypoint.sh
root      6291  1462  0 14:29 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/2a38c933f7ce
root      6306  6009  0 14:45 ?        00:00:01 /usr/local/bin/python /usr/local/bin/gunicorn main:app -b flask:5000 --log-level=info --error-logfile=/var/lo
root      6372  9581  0 14:45 ?        00:00:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 2053 -container-ip 172.24.0.12 -container-port 4
root      6406  1462  0 14:45 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/bec60196934e
root      6454  6406  0 14:45 ?        00:00:00 nginx: master process nginx -g daemon off;
root      6494  6306  0 14:45 ?        00:00:01 /usr/local/bin/python /usr/local/bin/gunicorn main:app -b flask:5000 --log-level=info --error-logfile=/var/lo
root      6561  1462  0 14:29 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/c1d5745e2daa
root      6771  6282  0 14:45 ?        00:00:00 cron -f
root      6883  1462  0 14:45 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/fbf05527b667
root      6923  1462  0 14:30 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/b462bca69269
systemd+  6946  6454  0 14:45 ?        00:00:00 nginx: worker process
root      7040  6883  0 14:45 ?        00:00:00 /bin/sh -c celery -A upload_notification worker -Q upload_notification -l INFO --config=celeryconfig
root      7089  1462  0 14:45 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/8c4966f9e11c
root      7098  1462  0 14:45 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/0311838f7988
root      7134  1462  0 14:45 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/4bb692499291
root      7204  7098  0 14:45 ?        00:00:00 /bin/sh -c celery -A send_notification worker -Q send_notification -l INFO --config=celeryconfig
root      7245  1462  0 14:45 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/db2e4d8157d9
root      7262  7089  0 14:45 ?        00:00:00 /bin/sh -c celery -A news worker -Q news -l INFO --config=celeryconfig
root      7278  7134  0 14:45 ?        00:00:00 /bin/sh -c celery -A after_market_closed worker -Q after_market_closed -l INFO --config=celeryconfig
root      7300  7245  0 14:45 ?        00:00:00 /bin/sh -c celery -A stock_price_upload_notification worker -Q stock_price_upload_notification -l INFO --conf
root      7527  1462  0 14:45 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/1b58a645334c
root      7556  7527  0 14:45 ?        00:00:00 npm
root      7578  7040  0 14:45 ?        00:00:28 /usr/local/bin/python /usr/local/bin/celery -A upload_notification worker -Q upload_notification -l INFO --co
root      7635  1462  0 14:30 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/6a6a411c85c1
root      7645  1464  0 14:30 ?        00:00:00 sshd: root@pts/0
root      7692  1462  0 14:30 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/6fa55051d1f8
root      7697  7204  0 14:45 ?        00:00:28 /usr/local/bin/python /usr/local/bin/celery -A send_notification worker -Q send_notification -l INFO --config
root      7736  7300  0 14:45 ?        00:00:28 /usr/local/bin/python /usr/local/bin/celery -A stock_price_upload_notification worker -Q stock_price_upload_n
root      7806  7278  0 14:45 ?        00:00:28 /usr/local/bin/python /usr/local/bin/celery -A after_market_closed worker -Q after_market_closed -l INFO --co
root      7812  7578  0 14:45 ?        00:00:00 /usr/local/bin/python /usr/local/bin/celery -A upload_notification worker -Q upload_notification -l INFO --co
root      7814  7578  0 14:45 ?        00:00:01 /usr/local/bin/python /usr/local/bin/celery -A upload_notification worker -Q upload_notification -l INFO --co
root      7826  7262  0 14:45 ?        00:00:31 /usr/local/bin/python /usr/local/bin/celery -A news worker -Q news -l INFO --config=celeryconfig
root      7840  7556  0 14:45 ?        00:00:00 sh -c node stock_price.js
root      7841  7840  0 14:45 ?        00:00:07 node stock_price.js
root      7850  7841  0 14:45 ?        00:00:08 python3 -u stock_price.py
root      7857  7736  0 14:45 ?        00:00:00 /usr/local/bin/python /usr/local/bin/celery -A stock_price_upload_notification worker -Q stock_price_upload_n
root      7858  7736  0 14:45 ?        00:00:00 /usr/local/bin/python /usr/local/bin/celery -A stock_price_upload_notification worker -Q stock_price_upload_n
root      7861  7806  0 14:45 ?        00:00:00 /usr/local/bin/python /usr/local/bin/celery -A after_market_closed worker -Q after_market_closed -l INFO --co
root      7862  7697  0 14:45 ?        00:00:00 /usr/local/bin/python /usr/local/bin/celery -A send_notification worker -Q send_notification -l INFO --config
root      7864  7806  0 14:45 ?        00:00:00 /usr/local/bin/python /usr/local/bin/celery -A after_market_closed worker -Q after_market_closed -l INFO --co
root      7865  7697  0 14:45 ?        00:00:00 /usr/local/bin/python /usr/local/bin/celery -A send_notification worker -Q send_notification -l INFO --config
root      7868  1462  0 14:30 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/3b799c405d83
root      7879  7826  0 14:45 ?        00:00:00 /usr/local/bin/python /usr/local/bin/celery -A news worker -Q news -l INFO --config=celeryconfig
root      7889  7826  0 14:45 ?        00:00:00 /usr/local/bin/python /usr/local/bin/celery -A news worker -Q news -l INFO --config=celeryconfig
root      7959  1462  0 14:45 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/4d64113d31ca
root      7996  7959  0 14:45 ?        00:00:00 /bin/sh -c celery -A stock_price_alert worker -Q stock_price_alert -l INFO --config=celeryconfig
root      8064  7996  0 14:45 ?        00:00:32 /usr/local/bin/python /usr/local/bin/celery -A stock_price_alert worker -Q stock_price_alert -l INFO --config
root      8139  1462  0 14:45 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/f286820c7b7d
root      8200  1462  0 14:45 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/2d15e08c449d
root      8227  1462  0 14:45 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/90c7ad0aa89f
root      8255  8139  0 14:45 ?        00:00:00 /bin/sh -c celery -A stock_price_alert worker -Q stock_price_alert -l INFO --config=celeryconfig
root      8263  8227  0 14:45 ?        00:00:00 /bin/sh -c celery -A stock_price_alert worker -Q stock_price_alert -l INFO --config=celeryconfig
root      8272  8200  0 14:45 ?        00:00:00 /bin/sh -c celery -A stock_price_alert worker -Q stock_price_alert -l INFO --config=celeryconfig
root      8312  8064  0 14:45 ?        00:00:02 /usr/local/bin/python /usr/local/bin/celery -A stock_price_alert worker -Q stock_price_alert -l INFO --config
root      8315  8064  0 14:45 ?        00:00:02 /usr/local/bin/python /usr/local/bin/celery -A stock_price_alert worker -Q stock_price_alert -l INFO --config
root      8408  8255  0 14:45 ?        00:00:31 /usr/local/bin/python /usr/local/bin/celery -A stock_price_alert worker -Q stock_price_alert -l INFO --config
root      8447  8263  0 14:45 ?        00:00:32 /usr/local/bin/python /usr/local/bin/celery -A stock_price_alert worker -Q stock_price_alert -l INFO --config
root      8481  8272  0 14:45 ?        00:00:32 /usr/local/bin/python /usr/local/bin/celery -A stock_price_alert worker -Q stock_price_alert -l INFO --config
root      8510  8408  0 14:45 ?        00:00:02 /usr/local/bin/python /usr/local/bin/celery -A stock_price_alert worker -Q stock_price_alert -l INFO --config
root      8517  8408  0 14:45 ?        00:00:02 /usr/local/bin/python /usr/local/bin/celery -A stock_price_alert worker -Q stock_price_alert -l INFO --config
do-agent  8548  5650  0 14:45 ?        00:00:00 inet_gethost 4
do-agent  8549  8548  0 14:45 ?        00:00:00 inet_gethost 4
root      8554  8447  0 14:45 ?        00:00:02 /usr/local/bin/python /usr/local/bin/celery -A stock_price_alert worker -Q stock_price_alert -l INFO --config
root      8557  8447  0 14:45 ?        00:00:02 /usr/local/bin/python /usr/local/bin/celery -A stock_price_alert worker -Q stock_price_alert -l INFO --config
root      8565  8481  0 14:45 ?        00:00:02 /usr/local/bin/python /usr/local/bin/celery -A stock_price_alert worker -Q stock_price_alert -l INFO --config
root      8567  8481  0 14:45 ?        00:00:02 /usr/local/bin/python /usr/local/bin/celery -A stock_price_alert worker -Q stock_price_alert -l INFO --config
...

不知何故,它们确实如此。我开始怀疑,这是正确的行为吗?在 docker upgrade 之前,我没有注意到这种行为。所以,升级后,我不确定这是否是正确的行为

答案1

是的,这是预期的行为。

Docker 容器不是虚拟机,它们是在同一共享内核上运行但在某种程度上是隔离的进程。

相关内容