Docker Top
Descrição
O comando docker top
exibe os processos em execução dentro de um container. É útil para ver quais processos estão ativos e monitorar o uso de recursos.
U$so
docker top CONTAINER [OPTIONS]
Exemplo de Uso
docker top my_container
Exemplo de Saída
UID PID PPID C STIME TTY TIME CMD
root 1234 1 0 Sep07 ? 00:00:01 /bin/bash
Quando Usar
Monitoramento de Processos: Para verificar quais processos estão rodando dentro do container e diagnosticar problemas relacionados ao uso de recursos.
Laboratório
$ docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9ba71cfedb2b nginx "/docker-entrypoint.…" 17 minutes ago Up 17 minutes 0.0.0.0:8080->80/tcp, :::8080->80/tcp affectionate_galois
$ docker container top 9ba71cfedb2b
UID PID PPID C STIME TTY TIME CMD
root 90368 90350 0 15:28 ? 00:00:00 nginx: master process nginx -g daemon off;
systemd+ 90419 90368 0 15:28 ? 00:00:00 nginx: worker process
systemd+ 90420 90368 0 15:28 ? 00:00:00 nginx: worker process
systemd+ 90421 90368 0 15:28 ? 00:00:00 nginx: worker process
systemd+ 90422 90368 0 15:28 ? 00:00:00 nginx: worker process
systemd+ 90423 90368 0 15:28 ? 00:00:00 nginx: worker process
systemd+ 90424 90368 0 15:28 ? 00:00:00 nginx: worker process
systemd+ 90425 90368 0 15:28 ? 00:00:00 nginx: worker process
systemd+ 90426 90368 0 15:28 ? 00:00:00 nginx: worker process
systemd+ 90427 90368 0 15:28 ? 00:00:00 nginx: worker process
systemd+ 90428 90368 0 15:28 ? 00:00:00 nginx: worker process
systemd+ 90429 90368 0 15:28 ? 00:00:00 nginx: worker process
systemd+ 90430 90368 0 15:28 ? 00:00:00 nginx: worker process
$ docker container run -d -p 8181:8080 marcelodpbarbieri/conversao-temperatura:v1
Unable to find image 'marcelodpbarbieri/conversao-temperatura:v1' locally
v1: Pulling from marcelodpbarbieri/conversao-temperatura
31e907dcc94a: Pull complete
2b84bdeb597a: Pull complete
f0392a7398c4: Pull complete
f41b53d4e76c: Pull complete
8dadaaf7622a: Pull complete
Digest: sha256:1fa5eb0aecb5e46bc7ed3e01f3ee9e3c8fb7336f9fea64b8839690825d1fa11b
Status: Downloaded newer image for marcelodpbarbieri/conversao-temperatura:v1
f2c39966bf8e7f4e636f645c7550e5172926a0f0e00037e7dd6dc8ea9806faab
$ docker container ls
CONTAINER ID IMAGE COMMAND
CREATED STATUS PORTS NAMES
f2c39966bf8e marcelodpbarbieri/conversao-temperatura:v1 "node server.js" 13 seconds ago Up 12 seconds 0.0.0.0:8181->8080/tcp, :::8181->8080/tcp wizardly_lichterman
$ docker container top f2c39966bf8e
UID PID PPID C STIME TTY TIME CMD
root 95234 95215 0 15:47 ? 00:00:00 node server.js
Last updated