Pesquisa de site

Como instalar o Docker no RHEL 7/CentOS 7


Como instalar o Docker no RHEL 7? Instalação do Docker CE no RHEL 7?. Os contêineres revolucionaram a implantação de aplicativos e a escalabilidade massiva de microsserviços. O Docker mudou o jogo, simplificando o processo de execução e gerenciamento de aplicativos em contêineres. Este artigo irá guiá-lo através da instalação do Docker no RHEL 7.

Para CentOS 7, verifique a instalação do Docker no CentOS 7

Etapa 1: Registre seu servidor RHEL 7

Comece registrando seu servidor RHEL 7 no Red Hat Subscription Management ou no servidor Satellite.

sudo subscription-manager register --auto-attach

Insira seu nome de usuário e senha quando solicitado.

Etapa 2: habilitar os repositórios necessários

Após registrar o sistema, habilite os repositórios RHEL 7 que possuem pacotes e dependências Docker.

sudo subscription-manager repos --enable=rhel-7-server-rpms \
  --enable=rhel-7-server-extras-rpms \
  --enable=rhel-7-server-optional-rpms

Etapa 3: Instale o Docker no servidor/desktop RHEL 7

Agora podemos instalar o Docker no RHEL 7 executando os comandos abaixo.

sudo yum install -y docker device-mapper-libs device-mapper-event-libs
sudo systemctl enable --now docker.service

Confirme o status do serviço.

$ systemctl status docker
 docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2023-08-24 12:38:09 UTC; 49s ago
     Docs: http://docs.docker.com
 Main PID: 1664 (dockerd-current)
   CGroup: /system.slice/docker.service
           ├─1664 /usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=docker-runc --exec-opt native.cgroupdriver=systemd --userland-proxy-...
           └─1670 /usr/bin/docker-containerd-current -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libcontaine...

Aug 24 12:38:08 cent7.mylab.io dockerd-current[1664]: time="2023-08-24T12:38:08.072923810Z" level=info msg="libcontainerd: new containerd process, pid: 1670"
Aug 24 12:38:09 cent7.mylab.io dockerd-current[1664]: time="2023-08-24T12:38:09.189090367Z" level=info msg="Graph migration to content-addressability took 0.00 seconds"
Aug 24 12:38:09 cent7.mylab.io dockerd-current[1664]: time="2023-08-24T12:38:09.190612187Z" level=info msg="Loading containers: start."
Aug 24 12:38:09 cent7.mylab.io dockerd-current[1664]: time="2023-08-24T12:38:09.271116538Z" level=info msg="Firewalld running: false"
Aug 24 12:38:09 cent7.mylab.io dockerd-current[1664]: time="2023-08-24T12:38:09.401669425Z" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daem... IP address"
Aug 24 12:38:09 cent7.mylab.io dockerd-current[1664]: time="2023-08-24T12:38:09.454871910Z" level=info msg="Loading containers: done."
Aug 24 12:38:09 cent7.mylab.io dockerd-current[1664]: time="2023-08-24T12:38:09.492523464Z" level=info msg="Daemon has completed initialization"
Aug 24 12:38:09 cent7.mylab.io dockerd-current[1664]: time="2023-08-24T12:38:09.492580166Z" level=info msg="Docker daemon" commit="7d71120/1.13.1" graphdriver=overlay2 version=1.13.1
Aug 24 12:38:09 cent7.mylab.io dockerd-current[1664]: time="2023-08-24T12:38:09.508536138Z" level=info msg="API listen on /var/run/docker.sock"
Aug 24 12:38:09 cent7.mylab.io systemd[1]: Started Docker Application Container Engine.
.......

Etapa 4: configurar registros inseguros/bloquear registros

Se você tiver registros Docker locais sem criptografia SSL para acesso, pode ser necessário colocá-los na lista de permissões.

$ sudo vi /etc/containers/registries.conf
[registries.insecure]
registries = ["reg1.example.com","reg2.example.com"]

Para bloquear o acesso a um registro, adicione o URL do registro na seção registries.block .

[registries.block]
registries = ['reg10.example.com']

Reinicie o serviço docker se você fizer uma alteração no arquivo de configuração.

sudo systemctl restart docker

Teste a instalação do Docker.

# docker pull hello-world
Using default tag: latest
Trying to pull repository registry.access.redhat.com/hello-world ... 
Pulling repository registry.access.redhat.com/hello-world
Trying to pull repository docker.io/library/hello-world ... 
latest: Pulling from docker.io/library/hello-world
1b930d010525: Pull complete 
Digest: sha256:6540fc08ee6e6b7b63468dc3317e3303aae178cb8a45ed3123180328bcc1d20f
Status: Downloaded newer image for docker.io/hello-world:latest

# docker run --rm hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

Agora você tem o Docker instalado no sistema RHEL 7. Feliz conteinerização.

Tag :

  • Instalação do Docker no RHEL 7
  • Instale o Docker no RHEL 7
  • Instalação do Docker CE no RHEL 7
  • Instale o Docker CE no servidor RHEL 7
  • Instale o Docker CE na estação de trabalho RHEL 7
  • Instale o Docker CE no RHEL 7 Desktop

Além disso, verifique:

  • Melhores livros para aprender Docker e Ansible Automation
  • Melhores livros de estudo do Kubernetes
  • Como instalar e usar o kit de ferramentas Source-To-Image (S2I) no Linux

Artigos relacionados: