domingo, 23 de junio de 2019

Docker Swarm Part4 Lab Python Flask Redis

   Un Swarm puede contener maquinas virtuales o reales, después de unirse al swarm serán llamados nodos.

   Para correr contenedores el swarm manager puede usar estas modalidades definidas en el compose file:

  - empiest node : Que llena el último contenedor utilizado con contenedores.
  - global :  Se asegura de que cada máquina tenga una replica del contenedor.

   Los swarm managers son las únicas máquinas que pueden ejecutar comandos de usuario y añadir otras máquinas a su swarm. la máquinas agregadas solo proporcionaran capacidad y se llaman workers.

Hacemos un Despliegue en el contenedor de nuestra aplicación

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker image ls
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
jalbertomr/lab1     python_app_1        68e8339a3346        42 hours ago        131MB
python_app          latest              68e8339a3346        42 hours ago        131MB
python              2.7-slim            ca96bab3e2aa        12 days ago         120MB
hello-world         latest              fce289e99eb9        5 months ago        1.84kB


bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker run -d -p 5000:4000 jalbertomr/lab1:python_app_1
50d43fe3d4cb6a2f76bdff02563ba3a91fef7847a3be74834ae6e657070c39e4
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker ps
CONTAINER ID        IMAGE                          COMMAND             CREATED             STATUS              PORTS                    NAMES
50d43fe3d4cb        jalbertomr/lab1:python_app_1   "python app.py"     2 minutes ago       Up 2 minutes        0.0.0.0:5000->4000/tcp   optimistic_morse
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ 

Creamos dos VM
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine create --driver virtualbox myvm1
Creating CA: /home/bext/.docker/machine/certs/ca.pem
Creating client certificate: /home/bext/.docker/machine/certs/cert.pem
Running pre-create checks...
(myvm1) Image cache directory does not exist, creating it at /home/bext/.docker/machine/cache...
(myvm1) No default Boot2Docker ISO found locally, downloading the latest release...
(myvm1) Latest release for github.com/boot2docker/boot2docker is v18.09.6
(myvm1) Downloading /home/bext/.docker/machine/cache/boot2docker.iso from https://github.com/boot2docker/boot2docker/releases/download/v18.09.6/boot2docker.iso...
(myvm1) 0%....10%....20%....30%....40%....50%....60%....70%....80%....90%....100%
Creating machine...
(myvm1) Copying /home/bext/.docker/machine/cache/boot2docker.iso to /home/bext/.docker/machine/machines/myvm1/boot2docker.iso...
(myvm1) Creating VirtualBox VM...
(myvm1) Creating SSH key...
(myvm1) Starting the VM...
(myvm1) Check network to re-create if needed...
(myvm1) Found a new host-only adapter: "vboxnet0"
(myvm1) Waiting for an IP...
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with boot2docker...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Checking connection to Docker...
Docker is up and running!
To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: docker-machine env myvm1

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine create --driver virtualbox myvm2
Running pre-create checks...
Creating machine...
(myvm2) Copying /home/bext/.docker/machine/cache/boot2docker.iso to /home/bext/.docker/machine/machines/myvm2/boot2docker.iso...
(myvm2) Creating VirtualBox VM...
(myvm2) Creating SSH key...
(myvm2) Starting the VM...
(myvm2) Check network to re-create if needed...
(myvm2) Waiting for an IP...
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with boot2docker...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Checking connection to Docker...
Docker is up and running!
To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: docker-machine env myvm2 
 
Obtenemos las IPs de las VMs

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ls
NAME    ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER     ERRORS
myvm1   -        virtualbox   Running   tcp://192.168.99.100:2376           v18.09.6   
myvm2   -        virtualbox   Running   tcp://192.168.99.101:2376           v18.09.6   

Inicializamos Swarm y le agregamos nodos. el primer nodo que se creo será el manager al cual se le agregan nodos posteriores. se envian comandos a la VM con el comando docker-machine ssh.

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker swarm init --advertise-addr 192.168.99.100"
Swarm initialized: current node (3mvoqxxsiu8lpj237jgcvepc0) is now a manager.

To add a worker to this swarm, run the following command:

    docker swarm join --token SWMTKN-1-2uc7kxz9y3kgg62b10o69c4tlwgqsek3x8zjkm6mgtwgnfalqz-61wb00ksyf7q6qihmssw2bw9l 192.168.99.100:2377

To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.

Ahora agregamos la VM2 al swarm

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker swarm join --token SWMTKN-1-2uc7kxz9y3kgg62b10o69c4tlwgqsek3x8zjkm6mgtwgnfalqz-61wb00ksyf7q6qihmssw2bw9l 192.168.99.100:2377
This node joined a swarm as a worker.
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ 


Bien ya tenemos un swarm, con dos nodos, el primero manager y el segundo worker. Veamos los nodos del swarms con comando en el manager.

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker node ls"
ID                            HOSTNAME            STATUS              AVAILABILITY        MANAGER STATUS      ENGINE VERSION
yuk4dbv1kgbqjk4ng1bz3x6a7     bext-VPCF13WFX      Ready               Active                                  18.09.6
3mvoqxxsiu8lpj237jgcvepc0 *   myvm1               Ready               Active              Leader              18.09.6
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ 

Agregamos la máquina local al swarm cuando debimos meter el vm2, instentemos sacarla.
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker swarm leave
Node left the swarm.
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker node ls"
ID                            HOSTNAME            STATUS              AVAILABILITY        MANAGER STATUS      ENGINE VERSION
yuk4dbv1kgbqjk4ng1bz3x6a7     bext-VPCF13WFX      Down                Active                                  18.09.6
3mvoqxxsiu8lpj237jgcvepc0 *   myvm1               Ready               Active              Leader              18.09.6
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$

Al parecer la máquina local está abajo. aunque disponible. agregemos la vm2 al swarm.

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm2 "docker swarm join --token SWMTKN-1-2uc7kxz9y3kgg62b10o69c4tlwgqsek3x8zjkm6mgtwgnfalqz-61wb00ksyf7q6qihmssw2bw9l 192.168.99.100:2377"
This node joined a swarm as a worker.
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker node ls"
ID                            HOSTNAME            STATUS              AVAILABILITY        MANAGER STATUS      ENGINE VERSION
yuk4dbv1kgbqjk4ng1bz3x6a7     bext-VPCF13WFX      Down                Active                                  18.09.6
3mvoqxxsiu8lpj237jgcvepc0 *   myvm1               Ready               Active              Leader              18.09.6
v022xu2ighk55gzazpt992t48     myvm2               Ready               Active                                  18.09.6
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ 

Intentemos eliminar el nodo de la máquina local.
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker node rm yuk4dbv1kgbqjk4ng1bz3x6a7"
yuk4dbv1kgbqjk4ng1bz3x6a7
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker node ls"
ID                            HOSTNAME            STATUS              AVAILABILITY        MANAGER STATUS      ENGINE VERSION
3mvoqxxsiu8lpj237jgcvepc0 *   myvm1               Ready               Active              Leader              18.09.6
v022xu2ighk55gzazpt992t48     myvm2               Ready               Active                                  18.09.6
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ 

Ok, ahora solo tenemos en el swarm dos nodos con VM1 y VM2. Ahora solo tenemos que desplegar la aplicación como se hizo en la parte 3.
....
Bueno, es este momento después de apagar la máquina y retomar el lab, veamos en que estado se quedo docker.

bext@bext-VPCF13WFX:~$ docker ps -a
CONTAINER ID        IMAGE                          COMMAND             CREATED             STATUS                      PORTS               NAMES
50d43fe3d4cb        jalbertomr/lab1:python_app_1   "python app.py"     4 hours ago         Exited (137) 2 hours ago                        optimistic_morse
2d160093dee0        jalbertomr/lab1:python_app_1   "python app.py"     29 hours ago        Exited (137) 28 hours ago                       hardcore_robinson
fb85fa9bd047        jalbertomr/lab1:python_app_1   "python app.py"     29 hours ago        Exited (137) 29 hours ago                       focused_mccarthy

bext@bext-VPCF13WFX:~$ docker service ls
Error response from daemon: This node is not a swarm manager. Use "docker swarm init" or "docker swarm join" to connect this node to swarm and try again.

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker swarm init
Swarm initialized: current node (7786lg66h9xi2fxuto8chkvzb) is now a manager.

To add a worker to this swarm, run the following command:

    docker swarm join --token SWMTKN-1-01k8gfkra09mfqoqqk69r6tmn14cutknydiu1yh1xo5svv6iil-436vrgfw2nq7xmu6vez4zgkey 10.143.113.239:2377

To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ls
NAME    ACTIVE   DRIVER       STATE     URL   SWARM   DOCKER    ERRORS
myvm1   -        virtualbox   Stopped                 Unknown   
myvm2   -        virtualbox   Stopped                 Unknown  

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine start myvm1
Starting "myvm1"...
(myvm1) Check network to re-create if needed...
(myvm1) Waiting for an IP...
Machine "myvm1" was started.
Waiting for SSH to be available...
Detecting the provisioner...
Started machines may have new IP addresses. You may need to re-run the `docker-machine env` command.
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine start myvm2
Starting "myvm2"...
(myvm2) Check network to re-create if needed...
(myvm2) Waiting for an IP...
Machine "myvm2" was started.
Waiting for SSH to be available...
Detecting the provisioner...
Started machines may have new IP addresses. You may need to re-run the `docker-machine env` command.
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ls
NAME    ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER     ERRORS
myvm1   -        virtualbox   Running   tcp://192.168.99.100:2376           v18.09.6   
myvm2   -        virtualbox   Running   tcp://192.168.99.101:2376           v18.09.6

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker node ls"
ID                            HOSTNAME            STATUS              AVAILABILITY        MANAGER STATUS      ENGINE VERSION
3mvoqxxsiu8lpj237jgcvepc0 *   myvm1               Ready               Active              Leader              18.09.6
v022xu2ighk55gzazpt992t48     myvm2               Ready               Active                                  18.09.6

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker service ls
ID                  NAME                MODE                REPLICAS            IMAGE               PORTS

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stack deploy -c docker-compose.yml miserviciolab
Creating network miserviciolab_webnet
Creating service miserviciolab_web
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker service ls
ID                  NAME                MODE                REPLICAS            IMAGE                           PORTS
wluh3wkcb0w8        miserviciolab_web   replicated          0/5                 jalbertomr/lab_1:python_app_1   *:5000->4000/tcp
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ 

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine scp docker-compose.yml myvm1:~
docker-compose.yml                            100%  395   629.9KB/s   00:00    
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker stack deploy -c docker-compose.yml miserviciolab"
Creating network miserviciolab_webnet
Creating service miserviciolab_web

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker stack ps miserviciolab"
ID                  NAME                      IMAGE                           NODE                DESIRED STATE       CURRENT STATE                     ERROR                              PORTS
qv5hn72epa36        miserviciolab_web.1       jalbertomr/lab_1:python_app_1   myvm1               Ready               Rejected 1 second ago             "No such image: jalbertomr/lab…"   
cxjjrqr2l79s         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 6 seconds ago            "No such image: jalbertomr/lab…"   
quauecgx0jan         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 11 seconds ago           "No such image: jalbertomr/lab…"   
812n05duglri         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 16 seconds ago           "No such image: jalbertomr/lab…"   
a2axgkv8tyam         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 20 seconds ago           "No such image: jalbertomr/lab…"   
3vu5os4wn9jy        miserviciolab_web.2       jalbertomr/lab_1:python_app_1   myvm1               Ready               Rejected 1 second ago             "No such image: jalbertomr/lab…"   
roj5gey3sem0         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 6 seconds ago            "No such image: jalbertomr/lab…"   
r3sek25m2qep         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 11 seconds ago           "No such image: jalbertomr/lab…"   
o8v7thl5be7y         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 16 seconds ago           "No such image: jalbertomr/lab…"   
ivtjaji4i548         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 21 seconds ago           "No such image: jalbertomr/lab…"   
y952aelnsyo4        miserviciolab_web.3       jalbertomr/lab_1:python_app_1   myvm1               Ready               Rejected 1 second ago             "No such image: jalbertomr/lab…"   
egy17dk7pz8a         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 6 seconds ago            "No such image: jalbertomr/lab…"   
qbq95w2twdjr         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 11 seconds ago           "No such image: jalbertomr/lab…"   
sj76novxbzdo         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 15 seconds ago           "No such image: jalbertomr/lab…"   
je2kvpsxi7hx         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 20 seconds ago           "No such image: jalbertomr/lab…"   
tz0evuefks8t        miserviciolab_web.4       jalbertomr/lab_1:python_app_1   myvm1               Ready               Rejected less than a second ago   "No such image: jalbertomr/lab…"   
4e73vk1stnai         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 5 seconds ago            "No such image: jalbertomr/lab…"   
wfoqc2qa1iuu         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 10 seconds ago           "No such image: jalbertomr/lab…"   
vugl3xg8mi2i         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 16 seconds ago           "No such image: jalbertomr/lab…"   
yi6nec7ar541         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 21 seconds ago           "No such image: jalbertomr/lab…"   
4z60hhlghti8        miserviciolab_web.5       jalbertomr/lab_1:python_app_1   myvm1               Ready               Rejected less than a second ago   "No such image: jalbertomr/lab…"   
o2nys2mtsyux         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 5 seconds ago            "No such image: jalbertomr/lab…"   
bjjclozx4ycm         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 10 seconds ago           "No such image: jalbertomr/lab…"   
bmtv58pn3vqo         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 16 seconds ago           "No such image: jalbertomr/lab…"   
ag5yalzrswob         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 21 seconds ago           "No such image: jalbertomr/lab…"   

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stack ps miserviciolab
ID                  NAME                      IMAGE                           NODE                DESIRED STATE       CURRENT STATE                      ERROR                              PORTS
u7rjytx5wbzp        miserviciolab_web.1       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Preparing less than a second ago                                      
gb9afjsldxmf         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 3 seconds ago             "No such image: jalbertomr/lab…"   
l819fe2l4w6h         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 10 seconds ago            "No such image: jalbertomr/lab…"   
zruqxwtq9aoj         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 25 seconds ago            "No such image: jalbertomr/lab…"   
qcj6gtwiyfs9         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 30 seconds ago            "No such image: jalbertomr/lab…"   
u34wx260yk1d        miserviciolab_web.2       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Preparing 2 seconds ago                                               
n8p03imzsvkd         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 4 seconds ago             "No such image: jalbertomr/lab…"   
dehvgohpyw36         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 11 seconds ago            "No such image: jalbertomr/lab…"   
k29rzmc26m3v         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 25 seconds ago            "No such image: jalbertomr/lab…"   
c1d14ai8n7x2         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 30 seconds ago            "No such image: jalbertomr/lab…"   
1lrn017y9xb3        miserviciolab_web.3       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Preparing 3 seconds ago                                               
jbg0mum4mor6         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 5 seconds ago             "No such image: jalbertomr/lab…"   
gf9az8sgsvpn         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 18 seconds ago            "No such image: jalbertomr/lab…"   
q7ggidsosnmf         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 26 seconds ago            "No such image: jalbertomr/lab…"   
ri94r22xqujc         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 36 seconds ago            "No such image: jalbertomr/lab…"   
0uu4pfpt91a4        miserviciolab_web.4       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Accepted less than a second ago                                       
umrb2tnmu9xv         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 2 seconds ago             "No such image: jalbertomr/lab…"   
zwbtiqf0hqnd         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 9 seconds ago             "No such image: jalbertomr/lab…"   
xh2r00kl6m4s         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 24 seconds ago            "No such image: jalbertomr/lab…"   
qsoq34aa2xtf         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 29 seconds ago            "No such image: jalbertomr/lab…"   
7418wsmu50uh        miserviciolab_web.5       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Preparing less than a second ago                                      
d4sjyji0crdj         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 2 seconds ago             "No such image: jalbertomr/lab…"   
orwjr2btu3bn         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 9 seconds ago             "No such image: jalbertomr/lab…"   
pq0b203ln52e         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 24 seconds ago            "No such image: jalbertomr/lab…"   
hockc2hwls8l         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 29 seconds ago            "No such image: jalbertomr/lab…"   
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ 

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine env myvm1
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.99.100:2376"
export DOCKER_CERT_PATH="/home/bext/.docker/machine/machines/myvm1"
export DOCKER_MACHINE_NAME="myvm1"
# Run this command to configure your shell: 
# eval $(docker-machine env myvm1)
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine env myvm2
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.99.101:2376"
export DOCKER_CERT_PATH="/home/bext/.docker/machine/machines/myvm2"
export DOCKER_MACHINE_NAME="myvm2"
# Run this command to configure your shell: 
# eval $(docker-machine env myvm2)

 Vemos que los depoys tiene estatus Rejected, esto es por que no encontro la imagen, y en otros intentos indicó que ya estaba ocupado el puerto 5000, esto al parecer es por que al inicio agregamos al swarm la máquina local lo que nos trajo consecuencia. Vamos a deshacer todo para iniciar nuevamente

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stack ps miserviciolab
ID                  NAME                      IMAGE                           NODE                DESIRED STATE       CURRENT STATE                      ERROR                              PORTS
8w7hpkoj47un        miserviciolab_web.1       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Preparing less than a second ago                                      
7mej0c9d9f7j         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 6 seconds ago             "No such image: jalbertomr/lab…"   
u254we3n2xn8         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 11 seconds ago            "No such image: jalbertomr/lab…"   
vr4ke5m7l8xn         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 18 seconds ago            "No such image: jalbertomr/lab…"   
prr4bspjr2ae         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 24 seconds ago            "No such image: jalbertomr/lab…"   
y23bguewgg8f        miserviciolab_web.2       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Running             Preparing 1 second ago                                                
r7z4g2vii484         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 9 seconds ago             "No such image: jalbertomr/lab…"   
nnw7cumkfdlu         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 14 seconds ago            "No such image: jalbertomr/lab…"   
zzsza2byw9yw         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 21 seconds ago            "No such image: jalbertomr/lab…"   
j4bg1tobd6h4         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 26 seconds ago            "No such image: jalbertomr/lab…"   
e1jm2iw2w80p        miserviciolab_web.3       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Preparing less than a second ago                                      
wf63893fv4uc         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 8 seconds ago             "No such image: jalbertomr/lab…"   
m4frt4syn4tn         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 13 seconds ago            "No such image: jalbertomr/lab…"   
tevs6opr4qxr         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 22 seconds ago            "No such image: jalbertomr/lab…"   
ekcmlchmszwx         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 29 seconds ago            "No such image: jalbertomr/lab…"   
6ckujc06xhjf        miserviciolab_web.4       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Preparing 1 second ago                                                
ozpe2ep0pma2         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 9 seconds ago             "No such image: jalbertomr/lab…"   
4eur1kjoahe3         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 14 seconds ago            "No such image: jalbertomr/lab…"   
r4zfc6pkbgqf         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 21 seconds ago            "No such image: jalbertomr/lab…"   
ou0c8xm8tti7         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 29 seconds ago            "No such image: jalbertomr/lab…"   
8gm9ss32cpiq        miserviciolab_web.5       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Preparing less than a second ago                                      
qv5cgbw5p2tz         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 6 seconds ago             "No such image: jalbertomr/lab…"   
cv6ei0vuoq5w         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 13 seconds ago            "No such image: jalbertomr/lab…"   
1w694yzaisby         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 18 seconds ago            "No such image: jalbertomr/lab…"   
64349zv6vjsc         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 25 seconds ago            "No such image: jalbertomr/lab…"   
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stack ps miserviciolab
ID                  NAME                      IMAGE                           NODE                DESIRED STATE       CURRENT STATE                     ERROR                              PORTS
ypmdjdlt1rt1        miserviciolab_web.1       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Rejected 2 seconds ago            "No such image: jalbertomr/lab…"   
kgfofvm70gko         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 12 seconds ago           "No such image: jalbertomr/lab…"   
pd6a4dh49q0g         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 22 seconds ago           "No such image: jalbertomr/lab…"   
zhw44iefg4m8         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 29 seconds ago           "No such image: jalbertomr/lab…"   
qun0n5h3mfbs         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 34 seconds ago           "No such image: jalbertomr/lab…"   
i2r9dveq4e4x        miserviciolab_web.2       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Rejected 2 seconds ago            "No such image: jalbertomr/lab…"   
ct4yjpzhzr3u         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 12 seconds ago           "No such image: jalbertomr/lab…"   
qn9ox4ndxmk0         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 21 seconds ago           "No such image: jalbertomr/lab…"   
4w1hq7j6kd9s         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 24 seconds ago           "No such image: jalbertomr/lab…"   
rjtdbrhu7i70         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 31 seconds ago           "No such image: jalbertomr/lab…"   
ibfdw0zzct53        miserviciolab_web.3       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Assigned less than a second ago                                      
9iugxn45z8md         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 3 seconds ago            "No such image: jalbertomr/lab…"   
73bnuh4lovun         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 16 seconds ago           "No such image: jalbertomr/lab…"   
dvpzx45rb02g         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 22 seconds ago           "No such image: jalbertomr/lab…"   
v7hcrt6x891x         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 27 seconds ago           "No such image: jalbertomr/lab…"   
zy5ntaozcjh8        miserviciolab_web.4       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Rejected 1 second ago             "No such image: jalbertomr/lab…"   
zgtlrru8xikd         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 3 seconds ago            "No such image: jalbertomr/lab…"   
1ov8c16ibrfb         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 17 seconds ago           "No such image: jalbertomr/lab…"   
jbh4dv2w4d91         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 24 seconds ago           "No such image: jalbertomr/lab…"   
lojhcmytqm9m         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 30 seconds ago           "No such image: jalbertomr/lab…"   
bo3t4cbim6ag        miserviciolab_web.5       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Preparing 2 seconds ago                                              
fnrccepjdj7p         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 3 seconds ago            "No such image: jalbertomr/lab…"   
xspm7npsndwn         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 17 seconds ago           "No such image: jalbertomr/lab…"   
ola7q13jd5m3         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 22 seconds ago           "No such image: jalbertomr/lab…"   
5mrsksbnjw59         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 29 seconds ago           "No such image: jalbertomr/lab…"   
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker image ls
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
jalbertomr/lab1     python_app_1        68e8339a3346        2 days ago          131MB
python_app          latest              68e8339a3346        2 days ago          131MB
python              2.7-slim            ca96bab3e2aa        12 days ago         120MB
hello-world         latest              fce289e99eb9        5 months ago        1.84kB
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker image ls"
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker container ls
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker run -d -p 5000:4000 jalbertomr/lab1:python_app_1
b385f7a6f006dc198afb68915c83aa269116332c6256370987f645c36926015b
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker image ls
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
jalbertomr/lab1     python_app_1        68e8339a3346        2 days ago          131MB
python_app          latest              68e8339a3346        2 days ago          131MB
python              2.7-slim            ca96bab3e2aa        12 days ago         120MB
hello-world         latest              fce289e99eb9        5 months ago        1.84kB
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker container ls
CONTAINER ID        IMAGE                          COMMAND             CREATED             STATUS              PORTS                    NAMES
b385f7a6f006        jalbertomr/lab1:python_app_1   "python app.py"     45 seconds ago      Up 17 seconds       0.0.0.0:5000->4000/tcp   fervent_easley
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker service ls
ID                  NAME                MODE                REPLICAS            IMAGE                           PORTS
wluh3wkcb0w8        miserviciolab_web   replicated          0/5                 jalbertomr/lab_1:python_app_1   *:5000->4000/tcp
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stack deploy -c docker-compose.yml miserviciolab
Updating service miserviciolab_web (id: wluh3wkcb0w84hphoj8gu2d2a)
image jalbertomr/lab_1:python_app_1 could not be accessed on a registry to record
its digest. Each node will access jalbertomr/lab_1:python_app_1 independently,
possibly leading to different nodes running different
versions of the image.

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker service ls
ID                  NAME                MODE                REPLICAS            IMAGE                           PORTS
wluh3wkcb0w8        miserviciolab_web   replicated          0/5                 jalbertomr/lab_1:python_app_1   *:5000->4000/tcp
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine scp docker-compose.yml myvm1:~
docker-compose.yml                                     100%  395   444.1KB/s   00:00    
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker stack deploy -c docker-compose.yml miserviciolab"
Updating service miserviciolab_web (id: 3pb7j58frk1yvht133zsxm27c)
image jalbertomr/lab_1:python_app_1 could not be accessed on a registry to record
its digest. Each node will access jalbertomr/lab_1:python_app_1 independently,
possibly leading to different nodes running different
versions of the image.

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker stack ps miserviciolab"
ID                  NAME                      IMAGE                           NODE                DESIRED STATE       CURRENT STATE                      ERROR                              PORTS
w4k4nvoiq9vl        miserviciolab_web.1       jalbertomr/lab_1:python_app_1   myvm1               Ready               Rejected 3 seconds ago             "No such image: jalbertomr/lab…"   
n9vwvci0spq3         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 8 seconds ago             "No such image: jalbertomr/lab…"   
kw6664tlynpk         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 13 seconds ago            "No such image: jalbertomr/lab…"   
eyu7fnog55xa         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 18 seconds ago            "No such image: jalbertomr/lab…"   
g7jje6hw1pa1         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 23 seconds ago            "No such image: jalbertomr/lab…"   
rl5ki2hlpoor        miserviciolab_web.2       jalbertomr/lab_1:python_app_1   myvm1               Ready               Rejected 3 seconds ago             "No such image: jalbertomr/lab…"   
g6iaukms8008         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 8 seconds ago             "No such image: jalbertomr/lab…"   
ojf3dtjkdgbd         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 13 seconds ago            "No such image: jalbertomr/lab…"   
sd1axtxpirrg         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 18 seconds ago            "No such image: jalbertomr/lab…"   
rq7c22533om8         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 23 seconds ago            "No such image: jalbertomr/lab…"   
t5n4zovyifuf        miserviciolab_web.3       jalbertomr/lab_1:python_app_1   myvm2               Ready               Preparing less than a second ago                                      
rlz4a8ce5q7z         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 4 seconds ago             "No such image: jalbertomr/lab…"   
u83temj745ar         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 9 seconds ago             "No such image: jalbertomr/lab…"   
98fbtu9wzsmq         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 14 seconds ago            "No such image: jalbertomr/lab…"   
hstbjwnfngmg         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 18 seconds ago            "No such image: jalbertomr/lab…"   
rhfxa1x4ycnw        miserviciolab_web.4       jalbertomr/lab_1:python_app_1   myvm2               Ready               Rejected less than a second ago    "No such image: jalbertomr/lab…"   
p1hx0xw16m9x         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 5 seconds ago             "No such image: jalbertomr/lab…"   
uesxkgrq08vx         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 10 seconds ago            "No such image: jalbertomr/lab…"   
kh671u42b13z         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 15 seconds ago            "No such image: jalbertomr/lab…"   
2kdbb8j76kl3         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 20 seconds ago            "No such image: jalbertomr/lab…"   
dlppu3oeemii        miserviciolab_web.5       jalbertomr/lab_1:python_app_1   myvm1               Ready               Rejected 3 seconds ago             "No such image: jalbertomr/lab…"   
kw5q6yj286o3         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 8 seconds ago             "No such image: jalbertomr/lab…"   
n1f5jza3k2ee         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 13 seconds ago            "No such image: jalbertomr/lab…"   
vhps54677rxt         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 18 seconds ago            "No such image: jalbertomr/lab…"   
0q0jcufy1yv2         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 23 seconds ago            "No such image: jalbertomr/lab…"   
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stack ps miserviciolab
ID                  NAME                      IMAGE                           NODE                DESIRED STATE       CURRENT STATE                     ERROR                              PORTS
fy3bz90pmzb6        miserviciolab_web.1       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Rejected 1 second ago             "No such image: jalbertomr/lab…"   
yb45b3y4snqc         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 5 seconds ago            "No such image: jalbertomr/lab…"   
rsby16qverpr         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 11 seconds ago           "No such image: jalbertomr/lab…"   
0e0wbeqqgkk7         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 16 seconds ago           "No such image: jalbertomr/lab…"   
j0t7pw46dzwz         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 24 seconds ago           "No such image: jalbertomr/lab…"   
z1wnn6qfllp0        miserviciolab_web.2       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Assigned less than a second ago                                      
n2p0uxgfeilp         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 2 seconds ago            "No such image: jalbertomr/lab…"   
s69iuhrecgic         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 8 seconds ago            "No such image: jalbertomr/lab…"   
6pe1mhlhwyb9         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 12 seconds ago           "No such image: jalbertomr/lab…"   
ufzri3sfyzfa         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 16 seconds ago           "No such image: jalbertomr/lab…"   
xku5r956ahgu        miserviciolab_web.3       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Accepted 1 second ago                                                
yufc9huzw8uo         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 5 seconds ago            "No such image: jalbertomr/lab…"   
fkaki9wsg2x0         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 7 seconds ago            "No such image: jalbertomr/lab…"   
2rt5cx6di7lf         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 15 seconds ago           "No such image: jalbertomr/lab…"   
t0bgorbmfqhq         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 22 seconds ago           "No such image: jalbertomr/lab…"   
ddk8q6s058kt        miserviciolab_web.4       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Preparing 2 seconds ago                                              
n0wav4l9vqeh         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 6 seconds ago            "No such image: jalbertomr/lab…"   
pfxbqjcyykqp         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 11 seconds ago           "No such image: jalbertomr/lab…"   
kwc8fczdmeaf         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 15 seconds ago           "No such image: jalbertomr/lab…"   
snf7bdx8c61u         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 22 seconds ago           "No such image: jalbertomr/lab…"   
al2xin5z84ky        miserviciolab_web.5       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Rejected less than a second ago   "No such image: jalbertomr/lab…"   
bhece2itnmbv         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 6 seconds ago            "No such image: jalbertomr/lab…"   
jza1sfns99yn         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 10 seconds ago           "No such image: jalbertomr/lab…"   
7pyv0q5u2n8s         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 16 seconds ago           "No such image: jalbertomr/lab…"   
z2aywphx0zcn         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 22 seconds ago           "No such image: jalbertomr/lab…"   
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker image ls
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
jalbertomr/lab1     python_app_1        68e8339a3346        2 days ago          131MB
python_app          latest              68e8339a3346        2 days ago          131MB
python              2.7-slim            ca96bab3e2aa        12 days ago         120MB
hello-world         latest              fce289e99eb9        5 months ago        1.84kB
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stack deploy -c docker-compose.yml myserviciolab
Creating network myserviciolab_webnet
Creating service myserviciolab_web
failed to create service myserviciolab_web: Error response from daemon: rpc error: code = InvalidArgument desc = port '5000' is already in use by service 'miserviciolab_web' (wluh3wkcb0w84hphoj8gu2d2a) as an ingress port
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker stack deploy -c docker-compose.yml miserviciolab"
Updating service miserviciolab_web (id: 3pb7j58frk1yvht133zsxm27c)
^[[Dimage jalbertomr/lab_1:python_app_1 could not be accessed on a registry to record
its digest. Each node will access jalbertomr/lab_1:python_app_1 independently,
possibly leading to different nodes running different
versions of the image.

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker stack deploy --with-registry-auth -c docker-compose.yml miserviciolab"
Updating service miserviciolab_web (id: 3pb7j58frk1yvht133zsxm27c)
image jalbertomr/lab_1:python_app_1 could not be accessed on a registry to record
its digest. Each node will access jalbertomr/lab_1:python_app_1 independently,
possibly leading to different nodes running different
versions of the image.

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker login
Authenticating with existing credentials...
WARNING! Your password will be stored unencrypted in /home/bext/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker stack deploy --with-registry-auth -c docker-compose.yml miserviciolab"
Updating service miserviciolab_web (id: 3pb7j58frk1yvht133zsxm27c)
image jalbertomr/lab_1:python_app_1 could not be accessed on a registry to record
its digest. Each node will access jalbertomr/lab_1:python_app_1 independently,
possibly leading to different nodes running different
versions of the image.

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker ps"
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker ps -a"
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker image ls"
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker container ls"
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stack ps
"docker stack ps" requires exactly 1 argument.
See 'docker stack ps --help'.

Usage:  docker stack ps [OPTIONS] STACK

List the tasks in the stack
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stack ps -a
unknown shorthand flag: 'a' in -a
See 'docker stack ps --help'.
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stack ps miserviciolab
ID                  NAME                      IMAGE                           NODE                DESIRED STATE       CURRENT STATE                     ERROR                              PORTS
rc7gqvs3fne3        miserviciolab_web.1       jalbertomr/lab_1:python_app_1                       Ready               Pending less than a second ago                                       
cq5i5f264q2o         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 3 seconds ago            "No such image: jalbertomr/lab…"   
3ztxsfvhf5y3         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 7 seconds ago            "No such image: jalbertomr/lab…"   
l89h9c4hdsn9         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 14 seconds ago           "No such image: jalbertomr/lab…"   
noy86vywsm4g         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 19 seconds ago           "No such image: jalbertomr/lab…"   
s53g5yrd54aj        miserviciolab_web.2       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Assigned less than a second ago                                      
3owmt0m5npqe         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 2 seconds ago            "No such image: jalbertomr/lab…"   
cu3yqle3kcdi         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 8 seconds ago            "No such image: jalbertomr/lab…"   
al8tnkkt5x89         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 13 seconds ago           "No such image: jalbertomr/lab…"   
9har058adcl4         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 19 seconds ago           "No such image: jalbertomr/lab…"   
ljdr9wpqs2aj        miserviciolab_web.3       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Assigned less than a second ago                                      
1fegyozsavz7         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 3 seconds ago            "No such image: jalbertomr/lab…"   
i739rv46h4pj         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 7 seconds ago            "No such image: jalbertomr/lab…"   
vfr8jssjhq0a         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 12 seconds ago           "No such image: jalbertomr/lab…"   
moa9c07jset0         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 18 seconds ago           "No such image: jalbertomr/lab…"   
lhiol2ssr482        miserviciolab_web.4       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Rejected 2 seconds ago            "No such image: jalbertomr/lab…"   
ipwhokvtagqm         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 6 seconds ago            "No such image: jalbertomr/lab…"   
l64faiokce9e         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 11 seconds ago           "No such image: jalbertomr/lab…"   
qv3iklcem1nh         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 15 seconds ago           "No such image: jalbertomr/lab…"   
u5tc860psibq         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 22 seconds ago           "No such image: jalbertomr/lab…"   
jxniab1xyfjq        miserviciolab_web.5       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Rejected 2 seconds ago            "No such image: jalbertomr/lab…"   
xsd8eupbtky3         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 7 seconds ago            "No such image: jalbertomr/lab…"   
0xa6hairp00k         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 12 seconds ago           "No such image: jalbertomr/lab…"   
gazqaal0lqq4         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 15 seconds ago           "No such image: jalbertomr/lab…"   
ndzsvkiv3k99         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 21 seconds ago           "No such image: jalbertomr/lab…"   
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stack rm miserviciolab
Removing service miserviciolab_web
Removing network miserviciolab_webnet
Failed to remove network l5etz5u4xoh18n4pvnn7n9gb5: Error response from daemon: rpc error: code = FailedPrecondition desc = network l5etz5u4xoh18n4pvnn7n9gb5 is in use by task he5dsh5wsy6o3tqnpus09s2r3Failed to remove some resources from stack: miserviciolab
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stack ps miserviciolab
ID                  NAME                          IMAGE                           NODE                DESIRED STATE       CURRENT STATE             ERROR                              PORTS
lltakz89zfen        wluh3wkcb0w84hphoj8gu2d2a.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Running             Rejected 7 seconds ago    "No such image: jalbertomr/lab…"   
f45i70ui77sm        wluh3wkcb0w84hphoj8gu2d2a.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Running             Rejected 12 seconds ago   "No such image: jalbertomr/lab…"   
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stack rm ^C
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stack rm lltakz89zfen
Nothing found in stack: lltakz89zfen
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docekr stack rm wluh3wkcb0w84hphoj8gu2d2a.1

Command 'docekr' not found, did you mean:

  command 'docker' from snap docker (18.06.1-ce)
  command 'docker' from deb docker.io

See 'snap info <snapname>' for additional versions.

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stack rm wluh3wkcb0w84hphoj8gu2d2a.1
Nothing found in stack: wluh3wkcb0w84hphoj8gu2d2a.1
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stack ps -a
unknown shorthand flag: 'a' in -a
See 'docker stack ps --help'.
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stack ps miserviciolab
ID                  NAME                          IMAGE                           NODE                DESIRED STATE       CURRENT STATE            ERROR                              PORTS
lltakz89zfen        wluh3wkcb0w84hphoj8gu2d2a.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Running             Rejected 3 minutes ago   "No such image: jalbertomr/lab…"   
f45i70ui77sm        wluh3wkcb0w84hphoj8gu2d2a.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Running             Rejected 3 minutes ago   "No such image: jalbertomr/lab…"   
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker container ls"
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker ps -a"
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker ps miserviciolab"
"docker ps" accepts no arguments.
See 'docker ps --help'.

Usage:  docker ps [OPTIONS]

List containers
exit status 1
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker ps -a"
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker image ls"
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker ps -a
CONTAINER ID        IMAGE                          COMMAND             CREATED             STATUS                      PORTS                    NAMES
b385f7a6f006        jalbertomr/lab1:python_app_1   "python app.py"     24 minutes ago      Up 24 minutes               0.0.0.0:5000->4000/tcp   fervent_easley
50d43fe3d4cb        jalbertomr/lab1:python_app_1   "python app.py"     6 hours ago         Exited (137) 4 hours ago                             optimistic_morse
2d160093dee0        jalbertomr/lab1:python_app_1   "python app.py"     31 hours ago        Exited (137) 29 hours ago                            hardcore_robinson
fb85fa9bd047        jalbertomr/lab1:python_app_1   "python app.py"     31 hours ago        Exited (137) 31 hours ago                            focused_mccarthy
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker rm b385f7a6f006
Error response from daemon: You cannot remove a running container b385f7a6f006dc198afb68915c83aa269116332c6256370987f645c36926015b. Stop the container before attempting removal or force remove
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stop b385f7a6f006
b385f7a6f006
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker ps -a
CONTAINER ID        IMAGE                          COMMAND             CREATED             STATUS                        PORTS               NAMES
b385f7a6f006        jalbertomr/lab1:python_app_1   "python app.py"     25 minutes ago      Exited (137) 11 seconds ago                       fervent_easley
50d43fe3d4cb        jalbertomr/lab1:python_app_1   "python app.py"     6 hours ago         Exited (137) 4 hours ago                          optimistic_morse
2d160093dee0        jalbertomr/lab1:python_app_1   "python app.py"     31 hours ago        Exited (137) 29 hours ago                         hardcore_robinson
fb85fa9bd047        jalbertomr/lab1:python_app_1   "python app.py"     31 hours ago        Exited (137) 31 hours ago                         focused_mccarthy
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stack ps -a
unknown shorthand flag: 'a' in -a
See 'docker stack ps --help'.
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stack ps miserviciolab
ID                  NAME                          IMAGE                           NODE                DESIRED STATE       CURRENT STATE            ERROR                              PORTS
lltakz89zfen        wluh3wkcb0w84hphoj8gu2d2a.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Running             Rejected 7 minutes ago   "No such image: jalbertomr/lab…"   
f45i70ui77sm        wluh3wkcb0w84hphoj8gu2d2a.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Running             Rejected 7 minutes ago   "No such image: jalbertomr/lab…"   
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker rm b385f7a6f006
b385f7a6f006
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stack ps miserviciolab
ID                  NAME                          IMAGE                           NODE                DESIRED STATE       CURRENT STATE            ERROR                              PORTS
lltakz89zfen        wluh3wkcb0w84hphoj8gu2d2a.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Running             Rejected 7 minutes ago   "No such image: jalbertomr/lab…"   
f45i70ui77sm        wluh3wkcb0w84hphoj8gu2d2a.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Running             Rejected 7 minutes ago   "No such image: jalbertomr/lab…"   
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stack rm miserviciolab
Removing network miserviciolab_webnet
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stack ps miserviciolab
ID                  NAME                          IMAGE                           NODE                DESIRED STATE       CURRENT STATE             ERROR                              PORTS
lltakz89zfen        wluh3wkcb0w84hphoj8gu2d2a.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Running             Rejected 13 minutes ago   "No such image: jalbertomr/lab…"   
f45i70ui77sm        wluh3wkcb0w84hphoj8gu2d2a.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Running             Rejected 13 minutes ago   "No such image: jalbertomr/lab…"   
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stack ps miserviciolab
ID                  NAME                          IMAGE                           NODE                DESIRED STATE       CURRENT STATE             ERROR                              PORTS
lltakz89zfen        wluh3wkcb0w84hphoj8gu2d2a.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Running             Rejected 14 minutes ago   "No such image: jalbertomr/lab…"   
f45i70ui77sm        wluh3wkcb0w84hphoj8gu2d2a.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Running             Rejected 14 minutes ago   "No such image: jalbertomr/lab…"   
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker swarm leave --force
Node left the swarm.
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker image ls
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
python_app          latest              68e8339a3346        2 days ago          131MB
jalbertomr/lab1     python_app_1        68e8339a3346        2 days ago          131MB
python              2.7-slim            ca96bab3e2aa        12 days ago         120MB
hello-world         latest              fce289e99eb9        5 months ago        1.84kB
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker container ls
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ls
NAME    ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER     ERRORS
myvm1   -        virtualbox   Running   tcp://192.168.99.100:2376           v18.09.6   
myvm2   -        virtualbox   Running   tcp://192.168.99.101:2376           v18.09.6   
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker swarm init --advertise-add 192.168.99.100"
unknown flag: --advertise-add
See 'docker swarm init --help'.
exit status 125
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker swarm init --advertise-addr 192.168.99.100"
Error response from daemon: This node is already part of a swarm. Use "docker swarm leave" to leave this swarm and join another one.
exit status 1
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker node ls
Error response from daemon: This node is not a swarm manager. Use "docker swarm init" or "docker swarm join" to connect this node to swarm and try again.
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker swarm init
Error response from daemon: could not choose an IP address to advertise since this system has multiple addresses on different interfaces (10.143.113.239 on wlp2s0 and 192.168.99.1 on vboxnet0) - specify one with --advertise-addr
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker swarm init --advertise-addr 10.143.113.239
Swarm initialized: current node (cnxiiwgb0iqiic6b0jm6xo2gc) is now a manager.

To add a worker to this swarm, run the following command:

    docker swarm join --token SWMTKN-1-1jh1bv8nzbcicdjvxc0wbjml8ikuxvy7bdd7upv6j8tdzro5v1-4m31bahm5g9yw8fqx1mcc66f8 10.143.113.239:2377

To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker node ls
ID                            HOSTNAME            STATUS              AVAILABILITY        MANAGER STATUS      ENGINE VERSION
cnxiiwgb0iqiic6b0jm6xo2gc *   bext-VPCF13WFX      Ready               Active              Leader              18.09.6
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker swarm leave --force
Node left the swarm.
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker node ls
Error response from daemon: This node is not a swarm manager. Use "docker swarm init" or "docker swarm join" to connect this node to swarm and try again.
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker ps -a
CONTAINER ID        IMAGE                          COMMAND             CREATED             STATUS                      PORTS               NAMES
50d43fe3d4cb        jalbertomr/lab1:python_app_1   "python app.py"     6 hours ago         Exited (137) 4 hours ago                        optimistic_morse
2d160093dee0        jalbertomr/lab1:python_app_1   "python app.py"     31 hours ago        Exited (137) 30 hours ago                       hardcore_robinson
fb85fa9bd047        jalbertomr/lab1:python_app_1   "python app.py"     31 hours ago        Exited (137) 31 hours ago                       focused_mccarthy
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stop $(docker ps -aq)
50d43fe3d4cb
2d160093dee0
fb85fa9bd047
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker rm $(docker ps -aq)
50d43fe3d4cb
2d160093dee0
fb85fa9bd047
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
jalbertomr/lab1     python_app_1        68e8339a3346        2 days ago          131MB
python_app          latest              68e8339a3346        2 days ago          131MB
python              2.7-slim            ca96bab3e2aa        12 days ago         120MB
hello-world         latest              fce289e99eb9        5 months ago        1.84kB
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker swarm leave --force
Error response from daemon: This node is not part of a swarm
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker ps -a"
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm2 "docker ps -a"
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker images ls"
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker container ls"
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm2 "docker leave --force"
unknown flag: --force
See 'docker --help'.

Usage: docker [OPTIONS] COMMAND

A self-sufficient runtime for containers

Options:
      --config string      Location of client config files (default
                           "/home/docker/.docker")
  -D, --debug              Enable debug mode
  -H, --host list          Daemon socket(s) to connect to
  -l, --log-level string   Set the logging level
                           ("debug"|"info"|"warn"|"error"|"fatal")
                           (default "info")
      --tls                Use TLS; implied by --tlsverify
      --tlscacert string   Trust certs signed only by this CA (default
                           "/home/docker/.docker/ca.pem")
      --tlscert string     Path to TLS certificate file (default
                           "/home/docker/.docker/cert.pem")
      --tlskey string      Path to TLS key file (default
                           "/home/docker/.docker/key.pem")
      --tlsverify          Use TLS and verify the remote
  -v, --version            Print version information and quit

Management Commands:
  builder     Manage builds
  checkpoint  Manage checkpoints
  config      Manage Docker configs
  container   Manage containers
  engine      Manage the docker engine
  image       Manage images
  manifest    Manage Docker image manifests and manifest lists
  network     Manage networks
  node        Manage Swarm nodes
  plugin      Manage plugins
  secret      Manage Docker secrets
  service     Manage services
  stack       Manage Docker stacks
  swarm       Manage Swarm
  system      Manage Docker
  trust       Manage trust on Docker images
  volume      Manage volumes

Commands:
  attach      Attach local standard input, output, and error streams to a running container
  build       Build an image from a Dockerfile
  commit      Create a new image from a container's changes
  cp          Copy files/folders between a container and the local filesystem
  create      Create a new container
  deploy      Deploy a new stack or update an existing stack
  diff        Inspect changes to files or directories on a container's filesystem
  events      Get real time events from the server
  exec        Run a command in a running container
  export      Export a container's filesystem as a tar archive
  history     Show the history of an image
  images      List images
  import      Import the contents from a tarball to create a filesystem image
  info        Display system-wide information
  inspect     Return low-level information on Docker objects
  kill        Kill one or more running containers
  load        Load an image from a tar archive or STDIN
  login       Log in to a Docker registry
  logout      Log out from a Docker registry
  logs        Fetch the logs of a container
  pause       Pause all processes within one or more containers
  port        List port mappings or a specific mapping for the container
  ps          List containers
  pull        Pull an image or a repository from a registry
  push        Push an image or a repository to a registry
  rename      Rename a container
  restart     Restart one or more containers
  rm          Remove one or more containers
  rmi         Remove one or more images
  run         Run a command in a new container
  save        Save one or more images to a tar archive (streamed to STDOUT by default)
  search      Search the Docker Hub for images
  start       Start one or more stopped containers
  stats       Display a live stream of container(s) resource usage statistics
  stop        Stop one or more running containers
  tag         Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
  top         Display the running processes of a container
  unpause     Unpause all processes within one or more containers
  update      Update configuration of one or more containers
  version     Show the Docker version information
  wait        Block until one or more containers stop, then print their exit codes

Run 'docker COMMAND --help' for more information on a command.

exit status 125
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm2 "docker swarm leave --force"
Node left the swarm.
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker swarm leave --force"
Node left the swarm.
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine 
Usage: docker-machine [OPTIONS] COMMAND [arg...]

Create and manage machines running Docker.

Version: 0.16.0, build 702c267f

Author:
  Docker Machine Contributors - <https://github.com/docker/machine>

Options:
  --debug, -D      Enable debug mode
  --storage-path, -s "/home/bext/.docker/machine" Configures storage path [$MACHINE_STORAGE_PATH]
  --tls-ca-cert      CA to verify remotes against [$MACHINE_TLS_CA_CERT]
  --tls-ca-key       Private key to generate certificates [$MACHINE_TLS_CA_KEY]
  --tls-client-cert      Client cert to use for TLS [$MACHINE_TLS_CLIENT_CERT]
  --tls-client-key      Private key used in client TLS auth [$MACHINE_TLS_CLIENT_KEY]
  --github-api-token      Token to use for requests to the Github API [$MACHINE_GITHUB_API_TOKEN]
  --native-ssh      Use the native (Go-based) SSH implementation. [$MACHINE_NATIVE_SSH]
  --bugsnag-api-token      BugSnag API token for crash reporting [$MACHINE_BUGSNAG_API_TOKEN]
  --help, -h      show help
  --version, -v      print the version
  
Commands:
  active  Print which machine is active
  config  Print the connection config for machine
  create  Create a machine
  env   Display the commands to set up the environment for the Docker client
  inspect  Inspect information about a machine
  ip   Get the IP address of a machine
  kill   Kill a machine
  ls   List machines
  provision  Re-provision existing machines
  regenerate-certs Regenerate TLS Certificates for a machine
  restart  Restart a machine
  rm   Remove a machine
  ssh   Log into or run a command on a machine with SSH.
  scp   Copy files between machines
  mount   Mount or unmount a directory from a machine with SSHFS.
  start   Start a machine
  status  Get the status of a machine
  stop   Stop a machine
  upgrade  Upgrade a machine to the latest version of Docker
  url   Get the URL of a machine
  version  Show the Docker Machine version or a machine docker version
  help   Shows a list of commands or help for one command
  
Run 'docker-machine COMMAND --help' for more information on a command.
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine rm myvm2
About to remove myvm2
WARNING: This action will delete both local reference and remote instance.
Are you sure? (y/n): y
Successfully removed myvm2
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine rm myvm1
About to remove myvm1
WARNING: This action will delete both local reference and remote instance.
Are you sure? (y/n): y
Successfully removed myvm1
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp
  
Comenzamos de nuevo

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine create --driver virtualbox myvm1
Running pre-create checks...
Creating machine...
(myvm1) Copying /home/bext/.docker/machine/cache/boot2docker.iso to /home/bext/.docker/machine/machines/myvm1/boot2docker.iso...
(myvm1) Creating VirtualBox VM...
(myvm1) Creating SSH key...
(myvm1) Starting the VM...
(myvm1) Check network to re-create if needed...
(myvm1) Waiting for an IP...
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with boot2docker...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Checking connection to Docker...
Docker is up and running!
To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: docker-machine env myvm1
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine create --driver virtualbox myvm2
Running pre-create checks...
Creating machine...
(myvm2) Copying /home/bext/.docker/machine/cache/boot2docker.iso to /home/bext/.docker/machine/machines/myvm2/boot2docker.iso...
(myvm2) Creating VirtualBox VM...
(myvm2) Creating SSH key...
(myvm2) Starting the VM...
(myvm2) Check network to re-create if needed...
(myvm2) Waiting for an IP...
docker-machine lsWaiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with boot2docker...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Checking connection to Docker...
Docker is up and running!
To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: docker-machine env myvm2
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ls
NAME    ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER     ERRORS
myvm1   -        virtualbox   Running   tcp://192.168.99.102:2376           v18.09.6   
myvm2   -        virtualbox   Running   tcp://192.168.99.103:2376           v18.09.6   
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker swarm init --advertise-addr 192.168.99.102"
Swarm initialized: current node (r3esibityhr02c238mfuyh9ag) is now a manager.

To add a worker to this swarm, run the following command:

    docker swarm join --token SWMTKN-1-2s0e2ciy8vz14cs55mg3le1xgvlr2r2u463o7so14yikh9gflm-8haoi6zlwpb5jts44etybva5b 192.168.99.102:2377

To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm2 "docker swarm join --token SWMTKN-1-2s0e2ciy8vz14cs55mg3le1xgvlr2r2u463o7so14yikh9gflm-8haoi6zlwpb5jts44etybva5b 192.168.99.102:2377"
This node joined a swarm as a worker.

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker node ls
ID                            HOSTNAME            STATUS              AVAILABILITY        MANAGER STATUS      ENGINE VERSION
0k6jdb92ds0k4tugo9jib1fg0 *   bext-VPCF13WFX      Ready               Active              Leader              18.09.6
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker node ls"
ID                            HOSTNAME            STATUS              AVAILABILITY        MANAGER STATUS      ENGINE VERSION
r3esibityhr02c238mfuyh9ag *   myvm1               Ready               Active              Leader              18.09.6
ryjrzzi8kwjk4b7o597sqpws0     myvm2               Ready               Active                                  18.09.6
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker container ls"
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker image ls"
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker run -d -p 5000:4000 jalbertomr/lab1:python_app_1"
Unable to find image 'jalbertomr/lab1:python_app_1' locally
python_app_1: Pulling from jalbertomr/lab1
fc7181108d40: Pulling fs layer
8c60b810a35a: Pulling fs layer
d207b275197c: Pulling fs layer
63184f224d60: Pulling fs layer
b4dd30ac9d9b: Pulling fs layer
b964fef1d36b: Pulling fs layer
799046ec1b70: Pulling fs layer
63184f224d60: Waiting
b4dd30ac9d9b: Waiting
b964fef1d36b: Waiting
799046ec1b70: Waiting
8c60b810a35a: Verifying Checksum
8c60b810a35a: Download complete
63184f224d60: Verifying Checksum
63184f224d60: Download complete
b4dd30ac9d9b: Verifying Checksum
b4dd30ac9d9b: Download complete
b964fef1d36b: Verifying Checksum
b964fef1d36b: Download complete
799046ec1b70: Verifying Checksum
799046ec1b70: Download complete
d207b275197c: Verifying Checksum
d207b275197c: Download complete
fc7181108d40: Verifying Checksum
fc7181108d40: Download complete
fc7181108d40: Pull complete
8c60b810a35a: Pull complete
d207b275197c: Pull complete
63184f224d60: Pull complete
b4dd30ac9d9b: Pull complete
b964fef1d36b: Pull complete
799046ec1b70: Pull complete
Digest: sha256:ce8c79d3c0bedbbf7b4c890581481ab90440fbd9005bf47da04059a21149d553
Status: Downloaded newer image for jalbertomr/lab1:python_app_1
071f56374b707c04a0fa992229d14b892a3c8341ef0fb8e015ae97eca377aa41

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker container ls"
CONTAINER ID        IMAGE                          COMMAND             CREATED             STATUS              PORTS                    NAMES
071f56374b70        jalbertomr/lab1:python_app_1   "python app.py"     21 seconds ago      Up 20 seconds       0.0.0.0:5000->4000/tcp   awesome_brattain
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ 

Configure a docker-machine shell to the swarm manager

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine env myvm1
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.99.102:2376"
export DOCKER_CERT_PATH="/home/bext/.docker/machine/machines/myvm1"
export DOCKER_MACHINE_NAME="myvm1"
# Run this command to configure your shell: 
# eval $(docker-machine env myvm1)
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ eval $(docker-machine env myvm1)
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ls
NAME    ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER     ERRORS
myvm1   *        virtualbox   Running   tcp://192.168.99.102:2376           v18.09.6   
myvm2   -        virtualbox   Running   tcp://192.168.99.103:2376           v18.09.6   
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp

Deplegar la applicacion en el administrador swarm

continua...

eot

No hay comentarios:

Publicar un comentario