Para copiar y pegar en play with docker pueden utilizar
control + insert //Copiar
shift + insert //Pegar
Conceptos básicos
Qué aprenderás sobre docker swarm
¿Qué es Swarm?
El problema de la escala: qué pasa cuando una computadora sóla no alcanza
Arquitectura de Docker Swarm
Preparando tus aplicaciones para Docker Swarm: los 12 factores
Primeros pasos
Instalación de Docker
Tu primer Docker Swarm
Fundamentos de Docker Swarm: servicios
Entendiendo el ciclo de vida de un servicio
Un playground de docker swarm gratuito: play-with-docker
Docker Swarm multinodo
Administrando Servicios
Administrando servicios en escala
Controlando el despliegue de servicios
Exponiendo aplicaciones al mundo exterior
Swarm avanzado
El Routing Mesh
Restricciones de despliegue
Disponibilidad de nodos
Networking y service discovery
Docker Swarm stacks
Reverse proxy: muchas aplicaciones, un sólo dominio
Swarm productivo
Arquitectura de un swarm productivo
Administración remota de swarm productivo
Consideraciones adicionales para un swarm produtivo
Conclusiones
Conclusiones
You don't have access to this class
Keep learning! Join and start boosting your career
Deploying a multi-node Swarm in Docker is an eye-opening experience that allows us to manage nodes efficiently. Initializing a Swarm requires configuring our Swarm Manager, which acts as a central coordinator of operations.
Initialize the Swarm: First, we use the docker swarm init
command. This command configures the current machine as the primary manager node. However, in an environment with multiple interfaces, it is important to specify which IP address to listen on, because the system might have multiple networks connected.
Configure the listening address: To resolve this, we run the command docker swarm init --advertise-addr [IP_ADDRESS]
, replacing [IP_ADDRESS]
with the IP of the interface to be used. For example:
docker swarm init --advertise-addr 192.168.0.33
Once the Swarm Manager is configured, we can add other nodes to the Swarm. To do this, each node must execute the Join Token on their systems:
Obtain the Join Token: After creating the Swarm, the initial command provides a token that other nodes need to join the Swarm as workers.
Join the Swarm: For each new node, run the provided command, similar to:
docker swarm join --token SWMTKN-1-61ykxgntbp2j4c0epce2fywz3z7z7g567ctdqkhdbnh4ayngoballc8s9mr2zisd192c7wv 192.168.0.33:2377
The status of the Swarm and who is in it is crucial. As we saw:
docker node ls
.The command shows important information such as which node is acting as leader and identifies which one we are currently working on, pointing them as Manager or Worker.
A Swarm is not only for managing machines, but for running distributed applications. Let's see how:
Create a service: subsidiary to the concept of containers, Docker services allow to replicate and move along the available nodes. For example, to create a simple service that pings
Google, we use:
docker service create --name pinger alpine ping www.google.com
Check where the services are running: We want to know on which node the service is running, and for that we run:
docker service ps pinger
Swarm management gives us a powerful tool to scale and manage applications. It is important that we eventually learn to:
As you continue to immerse yourself in the world of Docker management, exciting and more complex capabilities await, promising continued technical learning. Keep exploring!
Contributions 17
Questions 7
Para copiar y pegar en play with docker pueden utilizar
control + insert //Copiar
shift + insert //Pegar
Genial, también fue sencillo desde virtualbox…
Hola! estoy intentado unir una maquina a docker swarm pero me da un error. Con maquinas de DO.
docker swarm join --token SWMTKN-1-2l43xegaq2gchqr2e…. ip:2377
Error response from daemon: Timeout was reached before node joined. The attempt to join the swarm will continue in the background. Use the "docker info" command to see the current swarm status of your node.
He estado mirando y es porque entre maquinas deben tener unos puertos abiertos. https://docs.docker.com/engine/swarm/swarm-tutorial/#open-protocols-and-ports-between-the-hosts
Como puedo habilitar estos puertos?
– Creamos el nodo manager
docker swarm init --advertise-addr <MANAGER-IP>
docker swarm init --advertise-addr 192.168.0.18
– Creamos una nueva instancia en play-with-docker (+ ADD NEW INSTANCE)
docker swarm join --token <TOKEN> <MANAGER-IP>:<PORT>
docker swarm join --token SWMTKN-1-32cege8duoof9cr405bi1fsmcga831l6fcecmznp5cxcfdc3vg-ci6f98tjfy9fzhr2swmmo3ter 192.168.0.18:2377
– Creamos otra nueva instancia en play-with-docker (+ ADD NEW INSTANCE)
docker swarm join --token <TOKEN> <MANAGER-IP>:<PORT>
docker swarm join --token SWMTKN-1-32cege8duoof9cr405bi1fsmcga831l6fcecmznp5cxcfdc3vg-ci6f98tjfy9fzhr2swmmo3ter 192.168.0.18:2377
– Nos dirigimos a la terminal del nodo MANAGER, observamos los 3 nodos
docker node ls
– Crear un servicio en este caso multinodo
docker service create --name pinger alpine ping www.google.com
– Ver listado de servicios
docker service ls
– Donde estan asignado las tareas de este servicio, nos indica que esta en el nodo 1
docker service ps pinger
– Podemos ver el container
docker ps
// iniciar docker swarm
docker swarm init
// iniciar docker swarm en caso de tener mas de una interfaz de red
docker swarm init --advertise-addr [“ip de la interfaz donde va a escuchar peticiones para unirse al swarm”]
// ver nodos del swarm *solo se puede visualizar desde un docker swarm manager
// Todo lo relativo al estado del swarm, a la administracion del swarm y todo lo que tiene que ver con el swarm en si lo van a manejar exclusivamente los managers
docker node ls
docker swarm init --advertise-addr IP
, para iniciar docker swarm con ip en específicodocker swarm join --token TOKEN server:puerto
, para unir un nodo como worker al server con puerto 2377docker node ls
, para ver los nodos swarm de docker.Las instancias que agregas desde playwithdocker, en un esquema de productividad son maquina físicas?
Pueden mandar la salida del comando a un archivo txt para copiarlo desde ahi, y luego pegarlo en las otras terminales:
$ comando > archivo.txt
luego entran a “editor” y ahi encuentran el archivo.
Play to docker , a jugar para comprender la arquitectura multinodo.
Por defecto las tareas son asignadas a cualquier nodo del swarm, para que no pase esto, hay que especificar en que nodos debe de correr el servicio.
Los nodos manager son los únicos que pueden hacer tareas relacionadas con el estado y la administración de swarm. Ésto por seguridad.
Muy interesante
docker service create --name pinger alpine ping www.google.com
docker service ps pinger
un comando simple y tienes tu servicio corriendo, muy buena herramienta.
Hola a todos.
Si luego de hacer:
$ docker swarm init --advertise-addr [IP]
se les pierde el token para unir el manager con los workers, pueden ver nuevamente el comando con esta linea:
$ docker swarm join-token worker
Saludos.
Para los que tengan problemas con los comandos de copiar/pegar investige un poco y serian los siguientes:
Copiar: Ctrl + Insert o Ctrl + FN + Insert
Pegar: Ctrl + Shift + v
Que bien el play-with-docker ya yo tenia 4 vm con fedora en VMware para kubernetes local, pero con esto los puedo dejar dormidos, lo siento, no tengo soporte para acentos muy vago para buscarlo en fedora.
Want to see more contributions, questions and answers from the community?