Executando containers continuamente

nginx
$ docker container run nginx
Unable to find image 'nginx:latest' locally
latest: Pulling from library/nginx
e4fff0779e6d: Pull complete
2a0cb278fd9f: Pull complete
7045d6c32ae2: Pull complete
03de31afb035: Pull complete
0f17be8dcff2: Pull complete
14b7e5e8f394: Pull complete
23fa5a7b99a6: Pull complete
Digest: sha256:447a8665cc1dab95b1ca778e162215839ccbb9189104c79d7ec3a81e14577add
Status: Downloaded newer image for nginx:latest
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
2024/08/15 21:43:00 [notice] 1#1: using the "epoll" event method
2024/08/15 21:43:00 [notice] 1#1: nginx/1.27.1
2024/08/15 21:43:00 [notice] 1#1: built by gcc 12.2.0 (Debian 12.2.0-14)
2024/08/15 21:43:00 [notice] 1#1: OS: Linux 5.15.146.1-microsoft-standard-WSL2
2024/08/15 21:43:00 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2024/08/15 21:43:00 [notice] 1#1: start worker processes
2024/08/15 21:43:00 [notice] 1#1: start worker process 29
2024/08/15 21:43:00 [notice] 1#1: start worker process 30
2024/08/15 21:43:00 [notice] 1#1: start worker process 31
2024/08/15 21:43:00 [notice] 1#1: start worker process 32
2024/08/15 21:43:00 [notice] 1#1: start worker process 33
2024/08/15 21:43:00 [notice] 1#1: start worker process 34
2024/08/15 21:43:00 [notice] 1#1: start worker process 35
2024/08/15 21:43:00 [notice] 1#1: start worker process 36
2024/08/15 21:43:00 [notice] 1#1: start worker process 37
2024/08/15 21:43:00 [notice] 1#1: start worker process 38
2024/08/15 21:43:00 [notice] 1#1: start worker process 39
2024/08/15 21:43:00 [notice] 1#1: start worker process 40
2024/08/15 21:43:10 [notice] 1#1: signal 28 (SIGWINCH) received
2024/08/15 21:43:10 [notice] 1#1: signal 28 (SIGWINCH) received
2024/08/15 21:43:11 [notice] 1#1: signal 28 (SIGWINCH) received
2024/08/15 21:43:11 [notice] 1#1: signal 28 (SIGWINCH) received
2024/08/15 21:43:11 [notice] 1#1: signal 28 (SIGWINCH) received
2024/08/15 21:43:11 [notice] 1#1: signal 28 (SIGWINCH) received
2024/08/15 21:43:11 [notice] 1#1: signal 28 (SIGWINCH) received
2024/08/15 21:43:11 [notice] 1#1: signal 28 (SIGWINCH) received
2024/08/15 21:43:11 [notice] 1#1: signal 28 (SIGWINCH) received
2024/08/15 21:43:11 [notice] 1#1: signal 28 (SIGWINCH) received
2024/08/15 21:43:11 [notice] 1#1: signal 28 (SIGWINCH) received
2024/08/15 21:43:11 [notice] 1#1: signal 28 (SIGWINCH) received
2024/08/15 21:43:12 [notice] 1#1: signal 28 (SIGWINCH) received
2024/08/15 21:43:20 [notice] 1#1: signal 28 (SIGWINCH) received
2024/08/15 21:43:20 [notice] 1#1: signal 28 (SIGWINCH) received
2024/08/15 21:43:20 [notice] 1#1: signal 28 (SIGWINCH) received
2024/08/15 21:43:20 [notice] 1#1: signal 28 (SIGWINCH) received
2024/08/15 21:43:21 [notice] 1#1: signal 28 (SIGWINCH) received
2024/08/15 21:43:21 [notice] 1#1: signal 28 (SIGWINCH) received
2024/08/15 21:43:21 [notice] 1#1: signal 28 (SIGWINCH) received
2024/08/15 21:43:21 [notice] 1#1: signal 28 (SIGWINCH) received
2024/08/15 21:43:21 [notice] 1#1: signal 28 (SIGWINCH) received
2024/08/15 21:43:21 [notice] 1#1: signal 28 (SIGWINCH) received
2024/08/15 21:43:21 [notice] 1#1: signal 28 (SIGWINCH) received
2024/08/15 21:43:21 [notice] 1#1: signal 28 (SIGWINCH) received
2024/08/15 21:43:21 [notice] 1#1: signal 28 (SIGWINCH) received
2024/08/15 21:43:21 [notice] 1#1: signal 28 (SIGWINCH) received
2024/08/15 21:43:21 [notice] 1#1: signal 28 (SIGWINCH) received
2024/08/15 21:43:21 [notice] 1#1: signal 28 (SIGWINCH) received
2024/08/15 21:43:21 [notice] 1#1: signal 28 (SIGWINCH) received
2024/08/15 21:43:21 [notice] 1#1: signal 28 (SIGWINCH) received
2024/08/15 21:43:21 [notice] 1#1: signal 28 (SIGWINCH) received
2024/08/15 21:43:21 [notice] 1#1: signal 28 (SIGWINCH) received
2024/08/15 21:43:21 [notice] 1#1: signal 28 (SIGWINCH) received
2024/08/15 21:43:21 [notice] 1#1: signal 28 (SIGWINCH) received
2024/08/15 21:43:21 [notice] 1#1: signal 28 (SIGWINCH) received

O terminal ficou preso!

Execução do container em modo detached (segundo plano):

Abrir o endereço http://localhost no navegador não funcionará. O container é executado de forma isolada.

Execução de uma instrução dentro do container:

Será iniciada a sessão de terminal interativa do contêiner. O prompt de comando mudará para refletir que está dentro do contêiner. A partir daí, pode-se executar comandos Linux como se estivesse em um servidor normal. Por exemplo, pode-se navegar pelo sistema de arquivos, instalar pacotes, modificar arquivos de configuração, verificar logs, etc.

Last updated