martes, 25 de junio de 2019

Docker Swarm Part4 Lab Continuación



En la parte anterior no quedamos intentando arrancar la aplicación en swarm en dos VM. así de analizeremos el estado del origen del desorden para reiniciar y liberar.


Consultamos el estado de las maquinas virtuales
bext@bext-VPCF13WFX:~$ docker-machine ls
NAME    ACTIVE   DRIVER       STATE     URL   SWARM   DOCKER    ERRORS
myvm1   -        virtualbox   Stopped                 Unknown   
myvm2   -        virtualbox   Stopped                 Unknown   
bext@bext-VPCF13WFX:~$ docker swarm 

Usage: docker swarm COMMAND

Manage Swarm

Commands:
  ca          Display and rotate the root CA
  init        Initialize a swarm
  join        Join a swarm as a node and/or manager
  join-token  Manage join tokens
  leave       Leave the swarm
  unlock      Unlock swarm
  unlock-key  Manage the unlock key
  update      Update the swarm

Run 'docker swarm COMMAND --help' for more information on a command.
 
Arrancamos MYVM1
 
bext@bext-VPCF13WFX:~$ 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. 

Y la MYVM2
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.

Nos ubicamos en nuestro dicrectorio de trabajo
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ ls
app.py       docker-compose.yml  myvm1             testRedis.py
app.py.save  Dockerfile          requirements.txt

Inicializamos swarm en la MYVM1
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker swarm init"
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

Tendremos que reinicailizar todo, el swarm. sacaremos las VM de cualquier swarm en el que esten y volverlas a meter a swarm.

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 ls
NAME    ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER     ERRORS
myvm1   -        virtualbox   Running   tcp://192.168.99.107:2376           v18.09.6   
myvm2   -        virtualbox   Running   tcp://192.168.99.108:2376           v18.09.6   

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "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.0.2.15 on eth0 and 192.168.99.107 on eth1) - specify one with --advertise-addr
exit status 1

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

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

    docker swarm join --token SWMTKN-1-2o7bclty8ty2e1oib8bg5cswj8m6wwmk8z9h4n70gwwgqohm23-9a4ckls09yt9xp4m02damrxch 192.168.99.107: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   Running   tcp://192.168.99.107:2376           v18.09.6   
myvm2   -        virtualbox   Running   tcp://192.168.99.108:2376           v18.09.6   
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker swarm join --token SWMTKN-1-2o7bclty8ty2e1oib8bg5cswj8m6wwmk8z9h4n70gwwgqohm23-9a4ckls09yt9xp4m02damrxch 192.168.99.107:2377"
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-machine ssh myvm2 "docker swarm join --token SWMTKN-1-2o7bclty8ty2e1oib8bg5cswj8m6wwmk8z9h4n70gwwgqohm23-9a4ckls09yt9xp4m02damrxch 192.168.99.107: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
vhwa6ov6kzjp0gpwn54tfnrsn *   myvm1               Ready               Active              Leader              18.09.6
xjljwcuaa2t60fl3aovswqsbj     myvm2               Ready               Active                                  18.09.6

Deployamos la aplicación a la VM1

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ cat docker-compose.yml
version: "3"
services:
  web:
    #remplazar username/repo:tag con el nombre y imagen
    #image: username/repo:tag
    image: jalbertomr/lab_1:python_app_1
    deploy:
      replicas: 5
      resources:
        limits:
          cpus: "0.1"
          memory: 50M
      restart_policy:
        condition: on-failure
    ports:
      - "5000:4000"
    networks:
      - webnet
networks:
  webnet:
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine scp docker-compose.yml myvm1:~
docker-compose.yml                            100%  396   305.2KB/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

Revisamos el servicio deployado

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker stack ps miserviciolab"
ID                  NAME                      IMAGE                           NODE                DESIRED STATE       CURRENT STATE                      ERROR                              PORTS
ez8825mfjuq1        miserviciolab_web.1       jalbertomr/lab_1:python_app_1   myvm1               Ready               Preparing less than a second ago                                      
0jtdk53zsv7i         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 1 second ago              "No such image: jalbertomr/lab…"   
22a4uifdd5qi         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 7 seconds ago             "No such image: jalbertomr/lab…"   
t41r56119v6t         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 14 seconds ago            "No such image: jalbertomr/lab…"   
stbeibxhtj4o         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 18 seconds ago            "No such image: jalbertomr/lab…"   
torgw6lwzh74        miserviciolab_web.2       jalbertomr/lab_1:python_app_1   myvm1               Ready               Assigned less than a second ago                                       
xfvbf390ved3         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 1 second ago              "No such image: jalbertomr/lab…"   
zbs841kbyz2r         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 8 seconds ago             "No such image: jalbertomr/lab…"   
stqx97ut7v7f         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 13 seconds ago            "No such image: jalbertomr/lab…"   
vmsls8ctt9ff         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 18 seconds ago            "No such image: jalbertomr/lab…"   
u7glqv8o2iou        miserviciolab_web.3       jalbertomr/lab_1:python_app_1   myvm1               Ready               Assigned less than a second ago                                       
tmlvg3o8id5p         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 1 second ago              "No such image: jalbertomr/lab…"   
1er27cybvixm         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 5 seconds ago             "No such image: jalbertomr/lab…"   
dcw49zft78ax         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 13 seconds ago            "No such image: jalbertomr/lab…"   
skeiodd72h36         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 18 seconds ago            "No such image: jalbertomr/lab…"   
sfx8fv62uj25        miserviciolab_web.4       jalbertomr/lab_1:python_app_1   myvm1               Ready               Assigned less than a second ago                                       
4ozsvucjtuvf         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 1 second ago              "No such image: jalbertomr/lab…"   
fgwfacs8att5         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 6 seconds ago             "No such image: jalbertomr/lab…"   
kcabd58g752b         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 13 seconds ago            "No such image: jalbertomr/lab…"   
0ay6febcai18         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 18 seconds ago            "No such image: jalbertomr/lab…"   
faa1bujqrcme        miserviciolab_web.5       jalbertomr/lab_1:python_app_1   myvm2               Ready               Rejected 1 second ago              "No such image: jalbertomr/lab…"   
yj8lp9q3x3jj         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 3 seconds ago             "No such image: jalbertomr/lab…"   
pjn8hqsuizkj         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 13 seconds ago            "No such image: jalbertomr/lab…"   
krekbi1dc6jn         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 18 seconds ago            "No such image: jalbertomr/lab…"   
i5om2swlcaff         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 23 seconds ago            "No such image: jalbertomr/lab…" 

Vemos una anomalia dice Rejected...

Tal vez no lo bajo del repositorio Docker, nos logeamos y reintentamos

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 ps miserviciolab"
ID                  NAME                      IMAGE                           NODE                DESIRED STATE       CURRENT STATE                      ERROR                              PORTS
ki8r6byl1gzo        miserviciolab_web.1       jalbertomr/lab_1:python_app_1   myvm1               Ready               Rejected less than a second ago    "No such image: jalbertomr/lab…"   
0jj33y7cmhv4         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 3 seconds ago             "No such image: jalbertomr/lab…"   
hyh1bny304xp         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 9 seconds ago             "No such image: jalbertomr/lab…"   
s1gfa10nz27e         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 13 seconds ago            "No such image: jalbertomr/lab…"   
ez8825mfjuq1         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 19 seconds ago            "No such image: jalbertomr/lab…"   
z0kzdc9xmnvg        miserviciolab_web.2       jalbertomr/lab_1:python_app_1   myvm1               Ready               Rejected less than a second ago    "No such image: jalbertomr/lab…"   
o07xrjb4fhk8         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 3 seconds ago             "No such image: jalbertomr/lab…"   
5vy8f4v28s6s         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 10 seconds ago            "No such image: jalbertomr/lab…"   
6e806au7xco7         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 14 seconds ago            "No such image: jalbertomr/lab…"   
torgw6lwzh74         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 19 seconds ago            "No such image: jalbertomr/lab…"   
k1s97bik6x8n        miserviciolab_web.3       jalbertomr/lab_1:python_app_1   myvm1               Ready               Rejected less than a second ago    "No such image: jalbertomr/lab…"   
uqg1hi727p94         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 5 seconds ago             "No such image: jalbertomr/lab…"   
ien6qe3ghjc6         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 10 seconds ago            "No such image: jalbertomr/lab…"   
p4wbod6kbp6x         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 14 seconds ago            "No such image: jalbertomr/lab…"   
u7glqv8o2iou         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 19 seconds ago            "No such image: jalbertomr/lab…"   
bhfmmwawa3pr        miserviciolab_web.4       jalbertomr/lab_1:python_app_1   myvm1               Ready               Rejected less than a second ago    "No such image: jalbertomr/lab…"   
tamkmv05jstb         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 3 seconds ago             "No such image: jalbertomr/lab…"   
p4x58hsfe9m2         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 10 seconds ago            "No such image: jalbertomr/lab…"   
xrhb7eof4i40         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 14 seconds ago            "No such image: jalbertomr/lab…"   
sfx8fv62uj25         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 19 seconds ago            "No such image: jalbertomr/lab…"   
26bt0tax3r6o        miserviciolab_web.5       jalbertomr/lab_1:python_app_1   myvm2               Ready               Preparing less than a second ago                                      
ss88cpn0ernk         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 3 seconds ago             "No such image: jalbertomr/lab…"   
3tf24g5l4thq         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 6 seconds ago             "No such image: jalbertomr/lab…"   
psvr497rf3py         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 12 seconds ago            "No such image: jalbertomr/lab…"   
5gdd09h4up3t         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 18 seconds ago            "No such image: jalbertomr/lab…"   
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ls
NAME    ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER     ERRORS
myvm1   -        virtualbox   Running   tcp://192.168.99.107:2376           v18.09.6   
myvm2   -        virtualbox   Running   tcp://192.168.99.108:2376           v18.09.6   
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker stack deploy -c docker-compose.yml miserviciolab"
Updating service miserviciolab_web (id: by4doymokvqeau7d5t40kpwz0)
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.


Finalmente si consultamos la aplicación en la dirección de cada una de las Dos VM, tenemos respuesta.

Ahora para descartar problemas de puerto modificamos la aplicacion para que funcione en el puerto 80, la probamos en la máquina local, y la subimios al docker hub.

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker build --tag=myapp .
Sending build context to Docker daemon   42.5kB
Step 1/7 : FROM python:2.7-slim
 ---> ca96bab3e2aa
Step 2/7 : WORKDIR /app
 ---> Using cache
 ---> a0af2215bb76
Step 3/7 : COPY . /app
 ---> c838eeb10b19
Step 4/7 : RUN pip install --trusted-host pypi.python.org -r requirements.txt
 ---> Running in d4a27e1c1987
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting flask (from -r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/9a/74/670ae9737d14114753b8c8fdf2e8bd212a05d3b361ab15b44937dfd40985/Flask-1.0.3-py2.py3-none-any.whl (92kB)
Collecting redis (from -r requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/ac/a7/cff10cc5f1180834a3ed564d148fb4329c989cbb1f2e196fc9a10fa07072/redis-3.2.1-py2.py3-none-any.whl (65kB)
Collecting itsdangerous>=0.24 (from flask->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/76/ae/44b03b253d6fade317f32c24d100b3b35c2239807046a4c953c7b89fa49e/itsdangerous-1.1.0-py2.py3-none-any.whl
Collecting Jinja2>=2.10 (from flask->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/1d/e7/fd8b501e7a6dfe492a433deb7b9d833d39ca74916fa8bc63dd1a4947a671/Jinja2-2.10.1-py2.py3-none-any.whl (124kB)
Collecting Werkzeug>=0.14 (from flask->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/9f/57/92a497e38161ce40606c27a86759c6b92dd34fcdb33f64171ec559257c02/Werkzeug-0.15.4-py2.py3-none-any.whl (327kB)
Collecting click>=5.1 (from flask->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/fa/37/45185cb5abbc30d7257104c434fe0b07e5a195a6847506c074527aa599ec/Click-7.0-py2.py3-none-any.whl (81kB)
Collecting MarkupSafe>=0.23 (from Jinja2>=2.10->flask->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/fb/40/f3adb7cf24a8012813c5edb20329eb22d5d8e2a0ecf73d21d6b85865da11/MarkupSafe-1.1.1-cp27-cp27mu-manylinux1_x86_64.whl
Installing collected packages: itsdangerous, MarkupSafe, Jinja2, Werkzeug, click, flask, redis
Successfully installed Jinja2-2.10.1 MarkupSafe-1.1.1 Werkzeug-0.15.4 click-7.0 flask-1.0.3 itsdangerous-1.1.0 redis-3.2.1
Removing intermediate container d4a27e1c1987
 ---> aff8d16a6029
Step 5/7 : EXPOSE 80
 ---> Running in 006087928d3e
Removing intermediate container 006087928d3e
 ---> d93f0310e619
Step 6/7 : ENV NAME Mundito (env var definido en Dockerfile)
 ---> Running in 2a43bf275738
Removing intermediate container 2a43bf275738
 ---> b00d84f1ea66
Step 7/7 : CMD ["python","app.py"]
 ---> Running in 078b6497b6c5
Removing intermediate container 078b6497b6c5
 ---> abba73b6a912
Successfully built abba73b6a912
Successfully tagged myapp:latest
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker image ls
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
myapp               latest              abba73b6a912        9 seconds ago       131MB
jalbertomr/lab1     python_app_1        68e8339a3346        3 days ago          131MB
python_app          latest              68e8339a3346        3 days ago          131MB
python              2.7-slim            ca96bab3e2aa        2 weeks ago         120MB
hello-world         latest              fce289e99eb9        5 months ago        1.84kB
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker run -p 4000:80 myapp
 * Serving Flask app "app" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on http://0.0.0.0:80/ (Press CTRL+C to quit)
172.17.0.1 - - [25/Jun/2019 17:32:30] "GET / HTTP/1.1" 200 -
^C
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ 
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker run -d -p 4000:80 pyapp
Unable to find image 'pyapp:latest' locally
docker: Error response from daemon: pull access denied for pyapp, repository does not exist or may require 'docker login'.
See 'docker run --help'.
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker run -d -p 4000:80 myapp
d8ddfcc73815d2bff01f4b7c178eba048c070cad1ddb46af9f9cb3e4c32a4240
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker container ls
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                  NAMES
d8ddfcc73815        myapp               "python app.py"     11 seconds ago      Up 7 seconds        0.0.0.0:4000->80/tcp   inspiring_antonelli
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker container stop d8ddfcc73815
d8ddfcc73815
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 image ls
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
myapp               latest              abba73b6a912        6 minutes ago       131MB
jalbertomr/lab1     python_app_1        68e8339a3346        3 days ago          131MB
python_app          latest              68e8339a3346        3 days ago          131MB
python              2.7-slim            ca96bab3e2aa        2 weeks ago         120MB
hello-world         latest              fce289e99eb9        5 months ago        1.84kB
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker rmi -f abba73b6a912
Untagged: myapp:latest
Deleted: sha256:abba73b6a91224649be060821ce853828d3126bfd4e3cbeb15defc85ef763a8b
Deleted: sha256:b00d84f1ea66c7d379284115231f4c6104b00c151be38f51362d8e10d4b65987
Deleted: sha256:d93f0310e619b55e43322aa0a6ac4a6d5a71239173a76a672b742b6bf27998a9
Deleted: sha256:aff8d16a6029d1b28cc3b387eb9cd7c54100ed2765634f959bcfb96ea5cbf2f2
Deleted: sha256:c838eeb10b199c0de069d56207c891a8aa575ab77f962d0dd141ba1afb13d893
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker build --tag=miapp80 .
Sending build context to Docker daemon   42.5kB
Step 1/7 : FROM python:2.7-slim
 ---> ca96bab3e2aa
Step 2/7 : WORKDIR /app
 ---> Using cache
 ---> a0af2215bb76
Step 3/7 : COPY . /app
 ---> ac7a94715447
Step 4/7 : RUN pip install --trusted-host pypi.python.org -r requirements.txt
 ---> Running in cb47f515a5cc
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting flask (from -r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/9a/74/670ae9737d14114753b8c8fdf2e8bd212a05d3b361ab15b44937dfd40985/Flask-1.0.3-py2.py3-none-any.whl (92kB)
Collecting redis (from -r requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/ac/a7/cff10cc5f1180834a3ed564d148fb4329c989cbb1f2e196fc9a10fa07072/redis-3.2.1-py2.py3-none-any.whl (65kB)
Collecting itsdangerous>=0.24 (from flask->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/76/ae/44b03b253d6fade317f32c24d100b3b35c2239807046a4c953c7b89fa49e/itsdangerous-1.1.0-py2.py3-none-any.whl
Collecting Jinja2>=2.10 (from flask->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/1d/e7/fd8b501e7a6dfe492a433deb7b9d833d39ca74916fa8bc63dd1a4947a671/Jinja2-2.10.1-py2.py3-none-any.whl (124kB)
Collecting Werkzeug>=0.14 (from flask->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/9f/57/92a497e38161ce40606c27a86759c6b92dd34fcdb33f64171ec559257c02/Werkzeug-0.15.4-py2.py3-none-any.whl (327kB)
Collecting click>=5.1 (from flask->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/fa/37/45185cb5abbc30d7257104c434fe0b07e5a195a6847506c074527aa599ec/Click-7.0-py2.py3-none-any.whl (81kB)
Collecting MarkupSafe>=0.23 (from Jinja2>=2.10->flask->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/fb/40/f3adb7cf24a8012813c5edb20329eb22d5d8e2a0ecf73d21d6b85865da11/MarkupSafe-1.1.1-cp27-cp27mu-manylinux1_x86_64.whl
Installing collected packages: itsdangerous, MarkupSafe, Jinja2, Werkzeug, click, flask, redis
Successfully installed Jinja2-2.10.1 MarkupSafe-1.1.1 Werkzeug-0.15.4 click-7.0 flask-1.0.3 itsdangerous-1.1.0 redis-3.2.1
Removing intermediate container cb47f515a5cc
 ---> e03a388a3549
Step 5/7 : EXPOSE 80
 ---> Running in 3585e2799936
Removing intermediate container 3585e2799936
 ---> a6908b4c7a13
Step 6/7 : ENV NAME Mundito (env var definido en Dockerfile)
 ---> Running in 8a4ca1befe44
Removing intermediate container 8a4ca1befe44
 ---> 1bcf80c4c538
Step 7/7 : CMD ["python","app.py"]
 ---> Running in 7c94cdf31f53
Removing intermediate container 7c94cdf31f53
 ---> 2052c9c9a9ea
Successfully built 2052c9c9a9ea
Successfully tagged miapp80:latest
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker run -d -p 4000:80 miapp80
43dd42c0b410b7bd80a1efb3f194036e34b0fe234e68e27fde530dc96c2ff99a
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker image ls
REPOSITORY          TAG                 IMAGE ID            CREATED              SIZE
miapp80             latest              2052c9c9a9ea        About a minute ago   131MB
jalbertomr/lab1     python_app_1        68e8339a3346        3 days ago           131MB
python_app          latest              68e8339a3346        3 days ago           131MB
python              2.7-slim            ca96bab3e2aa        2 weeks ago          120MB
hello-world         latest              fce289e99eb9        5 months ago         1.84kB
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker tag miapp80 jalbertomr/lab1:miapp80
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker image ls
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
jalbertomr/lab1     miapp80             2052c9c9a9ea        2 minutes ago       131MB
miapp80             latest              2052c9c9a9ea        2 minutes ago       131MB
jalbertomr/lab1     python_app_1        68e8339a3346        3 days ago          131MB
python_app          latest              68e8339a3346        3 days ago          131MB
python              2.7-slim            ca96bab3e2aa        2 weeks ago         120MB
hello-world         latest              fce289e99eb9        5 months ago        1.84kB
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker push jalbertomr/lab1:miapp80
The push refers to repository [docker.io/jalbertomr/lab1]
2c88d935d30c: Pushed 
f07050736df9: Pushed 
c2a45b91534b: Layer already exists 
a212ef9c5ee1: Layer already exists 
a47fa5565167: Layer already exists 
658556256f47: Layer already exists 
cf5b3c6798f7: Layer already exists 
miapp80: digest: sha256:88de2ec527b9892b4f62b1ccc6a347ab2927f3f76aa657394cbffd74a5e6d830 size: 1789
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker swarm init
Error response from daemon: This node is already part of a swarm. Use "docker swarm leave" to leave this swarm and join another one.
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stack deploy -c docker-compose.yml miappcompose80
Creating network miappcompose80_webnet
Creating service miappcompose80_web
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                        PORTS                  NAMES
43dd42c0b410        miapp80             "python app.py"     6 minutes ago       Up 6 minutes                  0.0.0.0:4000->80/tcp   distracted_joliot
d8ddfcc73815        abba73b6a912        "python app.py"     13 minutes ago      Exited (137) 12 minutes ago                          inspiring_antonelli
b1ec5b08a2b7        abba73b6a912        "python app.py"     16 minutes ago      Exited (0) 15 minutes ago                            reverent_noether
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker service ls
ID                  NAME                 MODE                REPLICAS            IMAGE                           PORTS
rjwk48zepee5        miappcompose80_web   replicated          0/5                 jalbertomr/lab_1:python_app_1   *:4000->80/tcp

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker service ps miappcompose80_web
ID                  NAME                       IMAGE                           NODE                DESIRED STATE       CURRENT STATE                     ERROR                              PORTS
xxdltljeenvv        miappcompose80_web.1       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Rejected less than a second ago   "No such image: jalbertomr/lab…"   
to4hvv56u3ty         \_ miappcompose80_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 4 seconds ago            "No such image: jalbertomr/lab…"   
jo66vp1dep62         \_ miappcompose80_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 8 seconds ago            "No such image: jalbertomr/lab…"   
76428sl92ibw         \_ miappcompose80_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 16 seconds ago           "No such image: jalbertomr/lab…"   
yxpaoi4iyc7x         \_ miappcompose80_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 23 seconds ago           "No such image: jalbertomr/lab…"   
izr466etqhlc        miappcompose80_web.2       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Preparing 1 second ago                                               
8uyt6xnrjux2         \_ miappcompose80_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 4 seconds ago            "No such image: jalbertomr/lab…"   
txd4tbxdsyer         \_ miappcompose80_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 7 seconds ago            "No such image: jalbertomr/lab…"   
eryo6ch4zz5y         \_ miappcompose80_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 15 seconds ago           "No such image: jalbertomr/lab…"   
6904739rinqv         \_ miappcompose80_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 23 seconds ago           "No such image: jalbertomr/lab…"   
gix741nuoy6u        miappcompose80_web.3       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Accepted less than a second ago                                      
oijoyg7yt02b         \_ miappcompose80_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 3 seconds ago            "No such image: jalbertomr/lab…"   
8223zwsl23td         \_ miappcompose80_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 7 seconds ago            "No such image: jalbertomr/lab…"   
s7kulu3i5fn1         \_ miappcompose80_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 16 seconds ago           "No such image: jalbertomr/lab…"   
m1h98fvujr3o         \_ miappcompose80_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 21 seconds ago           "No such image: jalbertomr/lab…"   
scf865yi10ub        miappcompose80_web.4       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Preparing 1 second ago                                               
yc8nhslxhiam         \_ miappcompose80_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 4 seconds ago            "No such image: jalbertomr/lab…"   
lwri5pqwqwp8         \_ miappcompose80_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 7 seconds ago            "No such image: jalbertomr/lab…"   
31mg7omtsxb9         \_ miappcompose80_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 20 seconds ago           "No such image: jalbertomr/lab…"   
id61sc5tk7gs         \_ miappcompose80_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 23 seconds ago           "No such image: jalbertomr/lab…"   
c7vmlhgrgfwh        miappcompose80_web.5       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Preparing 1 second ago                                               
g6bg6yyzajez         \_ miappcompose80_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 4 seconds ago            "No such image: jalbertomr/lab…"   
i0hii72gyjwr         \_ miappcompose80_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 8 seconds ago            "No such image: jalbertomr/lab…"   
v5i4irn3jjt3         \_ miappcompose80_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 12 seconds ago           "No such image: jalbertomr/lab…"   
xsiu6pqipx03         \_ miappcompose80_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 23 seconds ago           "No such image: jalbertomr/lab…"   
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker container ls 
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                  NAMES
43dd42c0b410        miapp80             "python app.py"     8 minutes ago       Up 8 minutes        0.0.0.0:4000->80/tcp   distracted_joliot

 No sigue indicando Rejected..., dice que no encuentra la imagen ???

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker service ps miappcompose80_web
ID                  NAME                       IMAGE                           NODE                DESIRED STATE       CURRENT STATE                      ERROR                              PORTS
kff0vm59hixu        miappcompose80_web.1       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Preparing 1 second ago                                                
l4fyksdg9dx0         \_ miappcompose80_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 4 seconds ago             "No such image: jalbertomr/lab…"   
tch00fkevc76         \_ miappcompose80_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 10 seconds ago            "No such image: jalbertomr/lab…"   
rt4m6xxkdc0w         \_ miappcompose80_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 16 seconds ago            "No such image: jalbertomr/lab…"   
d5401skgswtt         \_ miappcompose80_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 20 seconds ago            "No such image: jalbertomr/lab…"   
nwvxbkmg8owq        miappcompose80_web.2       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Rejected 2 seconds ago             "No such image: jalbertomr/lab…"   
nniu1376wsxa         \_ miappcompose80_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 7 seconds ago             "No such image: jalbertomr/lab…"   
x385d22dlpyo         \_ miappcompose80_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 11 seconds ago            "No such image: jalbertomr/lab…"   
xpbptn3qs81j         \_ miappcompose80_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 15 seconds ago            "No such image: jalbertomr/lab…"   
umr7gaw15h7a         \_ miappcompose80_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 20 seconds ago            "No such image: jalbertomr/lab…"   
l9q5ioh32020        miappcompose80_web.3       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Preparing less than a second ago                                      
lh970ployvyw         \_ miappcompose80_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 4 seconds ago             "No such image: jalbertomr/lab…"   
6pzxm4y4fqq5         \_ miappcompose80_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 10 seconds ago            "No such image: jalbertomr/lab…"   
ityst4551hi5         \_ miappcompose80_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 14 seconds ago            "No such image: jalbertomr/lab…"   
yacaigzd7jko         \_ miappcompose80_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 18 seconds ago            "No such image: jalbertomr/lab…"   
tauaxb2weqnb        miappcompose80_web.4       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Assigned less than a second ago                                       
i84d1gy6852j         \_ miappcompose80_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 2 seconds ago             "No such image: jalbertomr/lab…"   
q7c8aivs0f9z         \_ miappcompose80_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 7 seconds ago             "No such image: jalbertomr/lab…"   
i9jt9hhjlznh         \_ miappcompose80_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 11 seconds ago            "No such image: jalbertomr/lab…"   
4bo7jrmniyuy         \_ miappcompose80_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 19 seconds ago            "No such image: jalbertomr/lab…"   
ai4t0906z5ib        miappcompose80_web.5       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Preparing 2 seconds ago                                               
xuanx4l8dacs         \_ miappcompose80_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 4 seconds ago             "No such image: jalbertomr/lab…"   
mk0675sqo5sg         \_ miappcompose80_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 9 seconds ago             "No such image: jalbertomr/lab…"   
dt5wwv8oyiyi         \_ miappcompose80_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 14 seconds ago            "No such image: jalbertomr/lab…"   
r1z3xx8m2p3z         \_ miappcompose80_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 20 seconds ago            "No such image: jalbertomr/lab…" 


bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker service ls
ID                  NAME                 MODE                REPLICAS            IMAGE                           PORTS
rjwk48zepee5        miappcompose80_web   replicated          0/5                 jalbertomr/lab_1:python_app_1   *:4000->80/tcp

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stack services miappcompose80
ID                  NAME                 MODE                REPLICAS            IMAGE                           PORTS
rjwk48zepee5        miappcompose80_web   replicated          0/5                 jalbertomr/lab_1:python_app_1   *:4000->80/tcp

 Nos indica 0 de 5 relicas corriendo ??, tiramos los contenedores

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker container ls
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                  NAMES
43dd42c0b410        miapp80             "python app.py"     21 minutes ago      Up 21 minutes       0.0.0.0:4000->80/tcp   distracted_joliot
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker rm 43dd42c0b410
Error response from daemon: You cannot remove a running container 43dd42c0b410b7bd80a1efb3f194036e34b0fe234e68e27fde530dc96c2ff99a. Stop the container before attempting removal or force remove
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stop 43dd42c0b410
43dd42c0b410
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker rm 43dd42c0b410
43dd42c0b410
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                        PORTS               NAMES
d8ddfcc73815        abba73b6a912        "python app.py"     29 minutes ago      Exited (137) 28 minutes ago                       inspiring_antonelli
b1ec5b08a2b7        abba73b6a912        "python app.py"     31 minutes ago      Exited (0) 31 minutes ago                         reverent_noether

Checamos imagenes y corremos aplicación en 80:80
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker image ls
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
jalbertomr/lab1     miapp80             2052c9c9a9ea        24 minutes ago      131MB
miapp80             latest              2052c9c9a9ea        24 minutes ago      131MB
jalbertomr/lab1     python_app_1        68e8339a3346        3 days ago          131MB
python_app          latest              68e8339a3346        3 days ago          131MB
python              2.7-slim            ca96bab3e2aa        2 weeks ago         120MB
hello-world         latest              fce289e99eb9        5 months ago        1.84kB
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker run -p 80:80 jalbertomr/lab1:miapp80
 * Serving Flask app "app" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on http://0.0.0.0:80/ (Press CTRL+C to quit)
172.17.0.1 - - [25/Jun/2019 18:06:22] "GET / HTTP/1.1" 200 -

 Esta espondiendo las peticiones, OK.

Deployamos en VM1 y nos indica que el puerto 5000 esta en uso, seguramente pruebas anteriores quedaron vivas.

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker node ls"
ID                            HOSTNAME            STATUS              AVAILABILITY        MANAGER STATUS      ENGINE VERSION
vhwa6ov6kzjp0gpwn54tfnrsn *   myvm1               Ready               Active              Leader              18.09.6
xjljwcuaa2t60fl3aovswqsbj     myvm2               Ready               Active                                  18.09.6
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker stack deploy -c docker-compose.yml miapp80swarm"
Creating network miapp80swarm_webnet
Creating service miapp80swarm_web
failed to create service miapp80swarm_web: Error response from daemon: rpc error: code = InvalidArgument desc = port '5000' is already in use by service 'miserviciolab_web' (by4doymokvqeau7d5t40kpwz0) as an ingress port
exit status 1

 Nuestro docker-compose.yml que debe correr en VM1, se corrige, la imagen no estaba con el nombre correcto.



bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "cat docker-compose.yml" | more
version: "3"
services:
  web:
    #remplazar username/repo:tag con el nombre y imagen
    #image: username/repo:tag
    image: jalbertomr/lab_1:myapp80
    deploy:
      replicas: 5
      resources:
        limits:
          cpus: "0.1"
          memory: 50M
      restart_policy:
        condition: on-failure
    ports:
      - "4000:80"
    networks:
      - webnet
networks:
  webnet:

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine scp docker-compose.yml myvm1:~
docker-compose.yml                            100%  396   305.2KB/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"
"docker stack ps" requires exactly 1 argument.
See 'docker stack ps --help'.

Usage:  docker stack ps [OPTIONS] STACK

List the tasks in the stack
exit status 1
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker stack ps -a"
unknown shorthand flag: 'a' in -a
See 'docker stack ps --help'.
exit status 125
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker stack ps miserviciolab"
ID                  NAME                      IMAGE                           NODE                DESIRED STATE       CURRENT STATE                      ERROR                              PORTS
ez8825mfjuq1        miserviciolab_web.1       jalbertomr/lab_1:python_app_1   myvm1               Ready               Preparing less than a second ago                                      
0jtdk53zsv7i         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 1 second ago              "No such image: jalbertomr/lab…"   
22a4uifdd5qi         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 7 seconds ago             "No such image: jalbertomr/lab…"   
t41r56119v6t         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 14 seconds ago            "No such image: jalbertomr/lab…"   
stbeibxhtj4o         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 18 seconds ago            "No such image: jalbertomr/lab…"   
torgw6lwzh74        miserviciolab_web.2       jalbertomr/lab_1:python_app_1   myvm1               Ready               Assigned less than a second ago                                       
xfvbf390ved3         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 1 second ago              "No such image: jalbertomr/lab…"   
zbs841kbyz2r         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 8 seconds ago             "No such image: jalbertomr/lab…"   
stqx97ut7v7f         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 13 seconds ago            "No such image: jalbertomr/lab…"   
vmsls8ctt9ff         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 18 seconds ago            "No such image: jalbertomr/lab…"   
u7glqv8o2iou        miserviciolab_web.3       jalbertomr/lab_1:python_app_1   myvm1               Ready               Assigned less than a second ago                                       
tmlvg3o8id5p         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 1 second ago              "No such image: jalbertomr/lab…"   
1er27cybvixm         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 5 seconds ago             "No such image: jalbertomr/lab…"   
dcw49zft78ax         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 13 seconds ago            "No such image: jalbertomr/lab…"   
skeiodd72h36         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 18 seconds ago            "No such image: jalbertomr/lab…"   
sfx8fv62uj25        miserviciolab_web.4       jalbertomr/lab_1:python_app_1   myvm1               Ready               Assigned less than a second ago                                       
4ozsvucjtuvf         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 1 second ago              "No such image: jalbertomr/lab…"   
fgwfacs8att5         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 6 seconds ago             "No such image: jalbertomr/lab…"   
kcabd58g752b         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 13 seconds ago            "No such image: jalbertomr/lab…"   
0ay6febcai18         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 18 seconds ago            "No such image: jalbertomr/lab…"   
faa1bujqrcme        miserviciolab_web.5       jalbertomr/lab_1:python_app_1   myvm2               Ready               Rejected 1 second ago              "No such image: jalbertomr/lab…"   
yj8lp9q3x3jj         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 3 seconds ago             "No such image: jalbertomr/lab…"   
pjn8hqsuizkj         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 13 seconds ago            "No such image: jalbertomr/lab…"   
krekbi1dc6jn         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 18 seconds ago            "No such image: jalbertomr/lab…"   
i5om2swlcaff         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 23 seconds ago            "No such image: jalbertomr/lab…"   
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 ps miserviciolab"
ID                  NAME                      IMAGE                           NODE                DESIRED STATE       CURRENT STATE                      ERROR                              PORTS
ki8r6byl1gzo        miserviciolab_web.1       jalbertomr/lab_1:python_app_1   myvm1               Ready               Rejected less than a second ago    "No such image: jalbertomr/lab…"   
0jj33y7cmhv4         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 3 seconds ago             "No such image: jalbertomr/lab…"   
hyh1bny304xp         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 9 seconds ago             "No such image: jalbertomr/lab…"   
s1gfa10nz27e         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 13 seconds ago            "No such image: jalbertomr/lab…"   
ez8825mfjuq1         \_ miserviciolab_web.1   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 19 seconds ago            "No such image: jalbertomr/lab…"   
z0kzdc9xmnvg        miserviciolab_web.2       jalbertomr/lab_1:python_app_1   myvm1               Ready               Rejected less than a second ago    "No such image: jalbertomr/lab…"   
o07xrjb4fhk8         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 3 seconds ago             "No such image: jalbertomr/lab…"   
5vy8f4v28s6s         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 10 seconds ago            "No such image: jalbertomr/lab…"   
6e806au7xco7         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 14 seconds ago            "No such image: jalbertomr/lab…"   
torgw6lwzh74         \_ miserviciolab_web.2   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 19 seconds ago            "No such image: jalbertomr/lab…"   
k1s97bik6x8n        miserviciolab_web.3       jalbertomr/lab_1:python_app_1   myvm1               Ready               Rejected less than a second ago    "No such image: jalbertomr/lab…"   
uqg1hi727p94         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 5 seconds ago             "No such image: jalbertomr/lab…"   
ien6qe3ghjc6         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 10 seconds ago            "No such image: jalbertomr/lab…"   
p4wbod6kbp6x         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 14 seconds ago            "No such image: jalbertomr/lab…"   
u7glqv8o2iou         \_ miserviciolab_web.3   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 19 seconds ago            "No such image: jalbertomr/lab…"   
bhfmmwawa3pr        miserviciolab_web.4       jalbertomr/lab_1:python_app_1   myvm1               Ready               Rejected less than a second ago    "No such image: jalbertomr/lab…"   
tamkmv05jstb         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 3 seconds ago             "No such image: jalbertomr/lab…"   
p4x58hsfe9m2         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 10 seconds ago            "No such image: jalbertomr/lab…"   
xrhb7eof4i40         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 14 seconds ago            "No such image: jalbertomr/lab…"   
sfx8fv62uj25         \_ miserviciolab_web.4   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 19 seconds ago            "No such image: jalbertomr/lab…"   
26bt0tax3r6o        miserviciolab_web.5       jalbertomr/lab_1:python_app_1   myvm2               Ready               Preparing less than a second ago                                      
ss88cpn0ernk         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 3 seconds ago             "No such image: jalbertomr/lab…"   
3tf24g5l4thq         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 6 seconds ago             "No such image: jalbertomr/lab…"   
psvr497rf3py         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 12 seconds ago            "No such image: jalbertomr/lab…"   
5gdd09h4up3t         \_ miserviciolab_web.5   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 18 seconds ago            "No such image: jalbertomr/lab…"   
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ls
NAME    ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER     ERRORS
myvm1   -        virtualbox   Running   tcp://192.168.99.107:2376           v18.09.6   
myvm2   -        virtualbox   Running   tcp://192.168.99.108:2376           v18.09.6   
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker stack deploy -c docker-compose.yml miserviciolab"
Updating service miserviciolab_web (id: by4doymokvqeau7d5t40kpwz0)
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 ls
NAME    ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER     ERRORS
myvm1   -        virtualbox   Running   tcp://192.168.99.107:2376           v18.09.6   
myvm2   -        virtualbox   Running   tcp://192.168.99.108:2376           v18.09.6   
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ curl http://192.168.99.107
curl: (7) Failed to connect to 192.168.99.107 port 80: Connection refused
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ curl http://192.168.99.107:5000
curl: (7) Failed to connect to 192.168.99.107 port 5000: Connection refused
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ curl http://192.168.99.107:4000
curl: (7) Failed to connect to 192.168.99.107 port 4000: Connection refused
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ curl http://192.168.99.107:4000
curl: (7) Failed to connect to 192.168.99.107 port 4000: Connection refused
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ curl http://192.168.99.107
curl: (7) Failed to connect to 192.168.99.107 port 80: Connection refused
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker images ls
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker build --tab=myApp .
unknown flag: --tab
See 'docker build --help'.
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker build --tag=myApp .
invalid argument "myApp" for "-t, --tag" flag: invalid reference format: repository name must be lowercase
See 'docker build --help'.
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker build --tag=myapp .
Sending build context to Docker daemon   42.5kB
Step 1/7 : FROM python:2.7-slim
 ---> ca96bab3e2aa
Step 2/7 : WORKDIR /app
 ---> Using cache
 ---> a0af2215bb76
Step 3/7 : COPY . /app
 ---> c838eeb10b19
Step 4/7 : RUN pip install --trusted-host pypi.python.org -r requirements.txt
 ---> Running in d4a27e1c1987
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting flask (from -r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/9a/74/670ae9737d14114753b8c8fdf2e8bd212a05d3b361ab15b44937dfd40985/Flask-1.0.3-py2.py3-none-any.whl (92kB)
Collecting redis (from -r requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/ac/a7/cff10cc5f1180834a3ed564d148fb4329c989cbb1f2e196fc9a10fa07072/redis-3.2.1-py2.py3-none-any.whl (65kB)
Collecting itsdangerous>=0.24 (from flask->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/76/ae/44b03b253d6fade317f32c24d100b3b35c2239807046a4c953c7b89fa49e/itsdangerous-1.1.0-py2.py3-none-any.whl
Collecting Jinja2>=2.10 (from flask->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/1d/e7/fd8b501e7a6dfe492a433deb7b9d833d39ca74916fa8bc63dd1a4947a671/Jinja2-2.10.1-py2.py3-none-any.whl (124kB)
Collecting Werkzeug>=0.14 (from flask->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/9f/57/92a497e38161ce40606c27a86759c6b92dd34fcdb33f64171ec559257c02/Werkzeug-0.15.4-py2.py3-none-any.whl (327kB)
Collecting click>=5.1 (from flask->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/fa/37/45185cb5abbc30d7257104c434fe0b07e5a195a6847506c074527aa599ec/Click-7.0-py2.py3-none-any.whl (81kB)
Collecting MarkupSafe>=0.23 (from Jinja2>=2.10->flask->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/fb/40/f3adb7cf24a8012813c5edb20329eb22d5d8e2a0ecf73d21d6b85865da11/MarkupSafe-1.1.1-cp27-cp27mu-manylinux1_x86_64.whl
Installing collected packages: itsdangerous, MarkupSafe, Jinja2, Werkzeug, click, flask, redis
Successfully installed Jinja2-2.10.1 MarkupSafe-1.1.1 Werkzeug-0.15.4 click-7.0 flask-1.0.3 itsdangerous-1.1.0 redis-3.2.1
Removing intermediate container d4a27e1c1987
 ---> aff8d16a6029
Step 5/7 : EXPOSE 80
 ---> Running in 006087928d3e
Removing intermediate container 006087928d3e
 ---> d93f0310e619
Step 6/7 : ENV NAME Mundito (env var definido en Dockerfile)
 ---> Running in 2a43bf275738
Removing intermediate container 2a43bf275738
 ---> b00d84f1ea66
Step 7/7 : CMD ["python","app.py"]
 ---> Running in 078b6497b6c5
Removing intermediate container 078b6497b6c5
 ---> abba73b6a912
Successfully built abba73b6a912
Successfully tagged myapp:latest
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker image ls
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
myapp               latest              abba73b6a912        9 seconds ago       131MB
jalbertomr/lab1     python_app_1        68e8339a3346        3 days ago          131MB
python_app          latest              68e8339a3346        3 days ago          131MB
python              2.7-slim            ca96bab3e2aa        2 weeks ago         120MB
hello-world         latest              fce289e99eb9        5 months ago        1.84kB
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker run -p 4000:80 myapp
 * Serving Flask app "app" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on http://0.0.0.0:80/ (Press CTRL+C to quit)
172.17.0.1 - - [25/Jun/2019 17:32:30] "GET / HTTP/1.1" 200 -
^C
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker run -d -p 4000:80 pyapp
Unable to find image 'pyapp:latest' locally
docker: Error response from daemon: pull access denied for pyapp, repository does not exist or may require 'docker login'.
See 'docker run --help'.
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker run -d -p 4000:80 myapp
d8ddfcc73815d2bff01f4b7c178eba048c070cad1ddb46af9f9cb3e4c32a4240
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker container ls
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                  NAMES
d8ddfcc73815        myapp               "python app.py"     11 seconds ago      Up 7 seconds        0.0.0.0:4000->80/tcp   inspiring_antonelli
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker container stop d8ddfcc73815
d8ddfcc73815
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 image ls
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
myapp               latest              abba73b6a912        6 minutes ago       131MB
jalbertomr/lab1     python_app_1        68e8339a3346        3 days ago          131MB
python_app          latest              68e8339a3346        3 days ago          131MB
python              2.7-slim            ca96bab3e2aa        2 weeks ago         120MB
hello-world         latest              fce289e99eb9        5 months ago        1.84kB
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker rmi -f abba73b6a912
Untagged: myapp:latest
Deleted: sha256:abba73b6a91224649be060821ce853828d3126bfd4e3cbeb15defc85ef763a8b
Deleted: sha256:b00d84f1ea66c7d379284115231f4c6104b00c151be38f51362d8e10d4b65987
Deleted: sha256:d93f0310e619b55e43322aa0a6ac4a6d5a71239173a76a672b742b6bf27998a9
Deleted: sha256:aff8d16a6029d1b28cc3b387eb9cd7c54100ed2765634f959bcfb96ea5cbf2f2
Deleted: sha256:c838eeb10b199c0de069d56207c891a8aa575ab77f962d0dd141ba1afb13d893
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker build --tag=miapp80 .
Sending build context to Docker daemon   42.5kB
Step 1/7 : FROM python:2.7-slim
 ---> ca96bab3e2aa
Step 2/7 : WORKDIR /app
 ---> Using cache
 ---> a0af2215bb76
Step 3/7 : COPY . /app
 ---> ac7a94715447
Step 4/7 : RUN pip install --trusted-host pypi.python.org -r requirements.txt
 ---> Running in cb47f515a5cc
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting flask (from -r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/9a/74/670ae9737d14114753b8c8fdf2e8bd212a05d3b361ab15b44937dfd40985/Flask-1.0.3-py2.py3-none-any.whl (92kB)
Collecting redis (from -r requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/ac/a7/cff10cc5f1180834a3ed564d148fb4329c989cbb1f2e196fc9a10fa07072/redis-3.2.1-py2.py3-none-any.whl (65kB)
Collecting itsdangerous>=0.24 (from flask->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/76/ae/44b03b253d6fade317f32c24d100b3b35c2239807046a4c953c7b89fa49e/itsdangerous-1.1.0-py2.py3-none-any.whl
Collecting Jinja2>=2.10 (from flask->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/1d/e7/fd8b501e7a6dfe492a433deb7b9d833d39ca74916fa8bc63dd1a4947a671/Jinja2-2.10.1-py2.py3-none-any.whl (124kB)
Collecting Werkzeug>=0.14 (from flask->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/9f/57/92a497e38161ce40606c27a86759c6b92dd34fcdb33f64171ec559257c02/Werkzeug-0.15.4-py2.py3-none-any.whl (327kB)
Collecting click>=5.1 (from flask->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/fa/37/45185cb5abbc30d7257104c434fe0b07e5a195a6847506c074527aa599ec/Click-7.0-py2.py3-none-any.whl (81kB)
Collecting MarkupSafe>=0.23 (from Jinja2>=2.10->flask->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/fb/40/f3adb7cf24a8012813c5edb20329eb22d5d8e2a0ecf73d21d6b85865da11/MarkupSafe-1.1.1-cp27-cp27mu-manylinux1_x86_64.whl
Installing collected packages: itsdangerous, MarkupSafe, Jinja2, Werkzeug, click, flask, redis
Successfully installed Jinja2-2.10.1 MarkupSafe-1.1.1 Werkzeug-0.15.4 click-7.0 flask-1.0.3 itsdangerous-1.1.0 redis-3.2.1
Removing intermediate container cb47f515a5cc
 ---> e03a388a3549
Step 5/7 : EXPOSE 80
 ---> Running in 3585e2799936
Removing intermediate container 3585e2799936
 ---> a6908b4c7a13
Step 6/7 : ENV NAME Mundito (env var definido en Dockerfile)
 ---> Running in 8a4ca1befe44
Removing intermediate container 8a4ca1befe44
 ---> 1bcf80c4c538
Step 7/7 : CMD ["python","app.py"]
 ---> Running in 7c94cdf31f53
Removing intermediate container 7c94cdf31f53
 ---> 2052c9c9a9ea
Successfully built 2052c9c9a9ea
Successfully tagged miapp80:latest
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker run -d -p 4000:80 miapp80
43dd42c0b410b7bd80a1efb3f194036e34b0fe234e68e27fde530dc96c2ff99a
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker image ls
REPOSITORY          TAG                 IMAGE ID            CREATED              SIZE
miapp80             latest              2052c9c9a9ea        About a minute ago   131MB
jalbertomr/lab1     python_app_1        68e8339a3346        3 days ago           131MB
python_app          latest              68e8339a3346        3 days ago           131MB
python              2.7-slim            ca96bab3e2aa        2 weeks ago          120MB
hello-world         latest              fce289e99eb9        5 months ago         1.84kB
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker tag miapp80 jalbertomr/lab1:miapp80
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker image ls
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
jalbertomr/lab1     miapp80             2052c9c9a9ea        2 minutes ago       131MB
miapp80             latest              2052c9c9a9ea        2 minutes ago       131MB
jalbertomr/lab1     python_app_1        68e8339a3346        3 days ago          131MB
python_app          latest              68e8339a3346        3 days ago          131MB
python              2.7-slim            ca96bab3e2aa        2 weeks ago         120MB
hello-world         latest              fce289e99eb9        5 months ago        1.84kB
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker push jalbertomr/lab1:miapp80
The push refers to repository [docker.io/jalbertomr/lab1]
2c88d935d30c: Pushed 
f07050736df9: Pushed 
c2a45b91534b: Layer already exists 
a212ef9c5ee1: Layer already exists 
a47fa5565167: Layer already exists 
658556256f47: Layer already exists 
cf5b3c6798f7: Layer already exists 
miapp80: digest: sha256:88de2ec527b9892b4f62b1ccc6a347ab2927f3f76aa657394cbffd74a5e6d830 size: 1789
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker swarm init
Error response from daemon: This node is already part of a swarm. Use "docker swarm leave" to leave this swarm and join another one.
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stack deploy -c docker-compose.yml miappcompose80
Creating network miappcompose80_webnet
Creating service miappcompose80_web
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                        PORTS                  NAMES
43dd42c0b410        miapp80             "python app.py"     6 minutes ago       Up 6 minutes                  0.0.0.0:4000->80/tcp   distracted_joliot
d8ddfcc73815        abba73b6a912        "python app.py"     13 minutes ago      Exited (137) 12 minutes ago                          inspiring_antonelli
b1ec5b08a2b7        abba73b6a912        "python app.py"     16 minutes ago      Exited (0) 15 minutes ago                            reverent_noether
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker service ls
ID                  NAME                 MODE                REPLICAS            IMAGE                           PORTS
rjwk48zepee5        miappcompose80_web   replicated          0/5                 jalbertomr/lab_1:python_app_1   *:4000->80/tcp
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker service ps miapp80no such service: miapp80
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker service ps miappcompose80
no such service: miappcompose80
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker service ls
ID                  NAME                 MODE                REPLICAS            IMAGE                           PORTS
rjwk48zepee5        miappcompose80_web   replicated          0/5                 jalbertomr/lab_1:python_app_1   *:4000->80/tcp
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker service ps miappcompose80_web
ID                  NAME                       IMAGE                           NODE                DESIRED STATE       CURRENT STATE                     ERROR                              PORTS
xxdltljeenvv        miappcompose80_web.1       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Rejected less than a second ago   "No such image: jalbertomr/lab…"   
to4hvv56u3ty         \_ miappcompose80_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 4 seconds ago            "No such image: jalbertomr/lab…"   
jo66vp1dep62         \_ miappcompose80_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 8 seconds ago            "No such image: jalbertomr/lab…"   
76428sl92ibw         \_ miappcompose80_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 16 seconds ago           "No such image: jalbertomr/lab…"   
yxpaoi4iyc7x         \_ miappcompose80_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 23 seconds ago           "No such image: jalbertomr/lab…"   
izr466etqhlc        miappcompose80_web.2       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Preparing 1 second ago                                               
8uyt6xnrjux2         \_ miappcompose80_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 4 seconds ago            "No such image: jalbertomr/lab…"   
txd4tbxdsyer         \_ miappcompose80_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 7 seconds ago            "No such image: jalbertomr/lab…"   
eryo6ch4zz5y         \_ miappcompose80_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 15 seconds ago           "No such image: jalbertomr/lab…"   
6904739rinqv         \_ miappcompose80_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 23 seconds ago           "No such image: jalbertomr/lab…"   
gix741nuoy6u        miappcompose80_web.3       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Accepted less than a second ago                                      
oijoyg7yt02b         \_ miappcompose80_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 3 seconds ago            "No such image: jalbertomr/lab…"   
8223zwsl23td         \_ miappcompose80_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 7 seconds ago            "No such image: jalbertomr/lab…"   
s7kulu3i5fn1         \_ miappcompose80_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 16 seconds ago           "No such image: jalbertomr/lab…"   
m1h98fvujr3o         \_ miappcompose80_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 21 seconds ago           "No such image: jalbertomr/lab…"   
scf865yi10ub        miappcompose80_web.4       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Preparing 1 second ago                                               
yc8nhslxhiam         \_ miappcompose80_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 4 seconds ago            "No such image: jalbertomr/lab…"   
lwri5pqwqwp8         \_ miappcompose80_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 7 seconds ago            "No such image: jalbertomr/lab…"   
31mg7omtsxb9         \_ miappcompose80_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 20 seconds ago           "No such image: jalbertomr/lab…"   
id61sc5tk7gs         \_ miappcompose80_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 23 seconds ago           "No such image: jalbertomr/lab…"   
c7vmlhgrgfwh        miappcompose80_web.5       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Preparing 1 second ago                                               
g6bg6yyzajez         \_ miappcompose80_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 4 seconds ago            "No such image: jalbertomr/lab…"   
i0hii72gyjwr         \_ miappcompose80_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 8 seconds ago            "No such image: jalbertomr/lab…"   
v5i4irn3jjt3         \_ miappcompose80_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 12 seconds ago           "No such image: jalbertomr/lab…"   
xsiu6pqipx03         \_ miappcompose80_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 23 seconds ago           "No such image: jalbertomr/lab…"   
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker container ls 
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                  NAMES
43dd42c0b410        miapp80             "python app.py"     8 minutes ago       Up 8 minutes        0.0.0.0:4000->80/tcp   distracted_joliot
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker service ps miappcompose80_web
ID                  NAME                       IMAGE                           NODE                DESIRED STATE       CURRENT STATE                      ERROR                              PORTS
kff0vm59hixu        miappcompose80_web.1       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Preparing 1 second ago                                                
l4fyksdg9dx0         \_ miappcompose80_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 4 seconds ago             "No such image: jalbertomr/lab…"   
tch00fkevc76         \_ miappcompose80_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 10 seconds ago            "No such image: jalbertomr/lab…"   
rt4m6xxkdc0w         \_ miappcompose80_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 16 seconds ago            "No such image: jalbertomr/lab…"   
d5401skgswtt         \_ miappcompose80_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 20 seconds ago            "No such image: jalbertomr/lab…"   
nwvxbkmg8owq        miappcompose80_web.2       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Rejected 2 seconds ago             "No such image: jalbertomr/lab…"   
nniu1376wsxa         \_ miappcompose80_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 7 seconds ago             "No such image: jalbertomr/lab…"   
x385d22dlpyo         \_ miappcompose80_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 11 seconds ago            "No such image: jalbertomr/lab…"   
xpbptn3qs81j         \_ miappcompose80_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 15 seconds ago            "No such image: jalbertomr/lab…"   
umr7gaw15h7a         \_ miappcompose80_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 20 seconds ago            "No such image: jalbertomr/lab…"   
l9q5ioh32020        miappcompose80_web.3       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Preparing less than a second ago                                      
lh970ployvyw         \_ miappcompose80_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 4 seconds ago             "No such image: jalbertomr/lab…"   
6pzxm4y4fqq5         \_ miappcompose80_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 10 seconds ago            "No such image: jalbertomr/lab…"   
ityst4551hi5         \_ miappcompose80_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 14 seconds ago            "No such image: jalbertomr/lab…"   
yacaigzd7jko         \_ miappcompose80_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 18 seconds ago            "No such image: jalbertomr/lab…"   
tauaxb2weqnb        miappcompose80_web.4       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Assigned less than a second ago                                       
i84d1gy6852j         \_ miappcompose80_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 2 seconds ago             "No such image: jalbertomr/lab…"   
q7c8aivs0f9z         \_ miappcompose80_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 7 seconds ago             "No such image: jalbertomr/lab…"   
i9jt9hhjlznh         \_ miappcompose80_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 11 seconds ago            "No such image: jalbertomr/lab…"   
4bo7jrmniyuy         \_ miappcompose80_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 19 seconds ago            "No such image: jalbertomr/lab…"   
ai4t0906z5ib        miappcompose80_web.5       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Preparing 2 seconds ago                                               
xuanx4l8dacs         \_ miappcompose80_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 4 seconds ago             "No such image: jalbertomr/lab…"   
mk0675sqo5sg         \_ miappcompose80_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 9 seconds ago             "No such image: jalbertomr/lab…"   
dt5wwv8oyiyi         \_ miappcompose80_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 14 seconds ago            "No such image: jalbertomr/lab…"   
r1z3xx8m2p3z         \_ miappcompose80_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 20 seconds ago            "No such image: jalbertomr/lab…"   
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stack services miappcompose80_web
Nothing found in stack: miappcompose80_web
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker service ls
ID                  NAME                 MODE                REPLICAS            IMAGE                           PORTS
rjwk48zepee5        miappcompose80_web   replicated          0/5                 jalbertomr/lab_1:python_app_1   *:4000->80/tcp
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stack services miappcompose80_web
Nothing found in stack: miappcompose80_web
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stack services miappcompose80_web
Nothing found in stack: miappcompose80_web
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stack ls
NAME                SERVICES            ORCHESTRATOR
miappcompose80      1                   Swarm
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stack services miappcompose80
ID                  NAME                 MODE                REPLICAS            IMAGE                           PORTS
rjwk48zepee5        miappcompose80_web   replicated          0/5                 jalbertomr/lab_1:python_app_1   *:4000->80/tcp
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stack ps miappcompose80
ID                  NAME                       IMAGE                           NODE                DESIRED STATE       CURRENT STATE                     ERROR                              PORTS
ob5wylqye82q        miappcompose80_web.1       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Assigned 2 seconds ago                                               
njntpm5tk472         \_ miappcompose80_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 2 seconds ago            "No such image: jalbertomr/lab…"   
jiphdsupqlhp         \_ miappcompose80_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 11 seconds ago           "No such image: jalbertomr/lab…"   
skal3kw1sh3u         \_ miappcompose80_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 16 seconds ago           "No such image: jalbertomr/lab…"   
856kv0aiyez6         \_ miappcompose80_web.1   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 22 seconds ago           "No such image: jalbertomr/lab…"   
4w2jf44efl7f        miappcompose80_web.2       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Preparing 2 seconds ago                                              
zu1d1r264yxw         \_ miappcompose80_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 4 seconds ago            "No such image: jalbertomr/lab…"   
m646fh9d6t5g         \_ miappcompose80_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 11 seconds ago           "No such image: jalbertomr/lab…"   
muaeau11ktyb         \_ miappcompose80_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 16 seconds ago           "No such image: jalbertomr/lab…"   
hki1ebtem6ti         \_ miappcompose80_web.2   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 22 seconds ago           "No such image: jalbertomr/lab…"   
vwtw0ey5nfrn        miappcompose80_web.3       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Running             Preparing 4 seconds ago                                              
t34qmhlil8yc         \_ miappcompose80_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 5 seconds ago            "No such image: jalbertomr/lab…"   
sqci3r853wag         \_ miappcompose80_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 11 seconds ago           "No such image: jalbertomr/lab…"   
t22zplkdc1z1         \_ miappcompose80_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 17 seconds ago           "No such image: jalbertomr/lab…"   
jfzzscvhc0l4         \_ miappcompose80_web.3   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 25 seconds ago           "No such image: jalbertomr/lab…"   
oxmjoh0i3ddy        miappcompose80_web.4       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Assigned 2 seconds ago                                               
tg7dd18soopj         \_ miappcompose80_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 3 seconds ago            "No such image: jalbertomr/lab…"   
p1jhcllkp5og         \_ miappcompose80_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 12 seconds ago           "No such image: jalbertomr/lab…"   
vegc37c18xmg         \_ miappcompose80_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 17 seconds ago           "No such image: jalbertomr/lab…"   
l2or9x6fra2w         \_ miappcompose80_web.4   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 23 seconds ago           "No such image: jalbertomr/lab…"   
908t85vysf7v        miappcompose80_web.5       jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Ready               Assigned less than a second ago                                      
0c0fozw2yigy         \_ miappcompose80_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 2 seconds ago            "No such image: jalbertomr/lab…"   
f8vx64hh2h1d         \_ miappcompose80_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 12 seconds ago           "No such image: jalbertomr/lab…"   
jcy5tw3utc7u         \_ miappcompose80_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 16 seconds ago           "No such image: jalbertomr/lab…"   
qrukddqokqz6         \_ miappcompose80_web.5   jalbertomr/lab_1:python_app_1   bext-VPCF13WFX      Shutdown            Rejected 26 seconds ago           "No such image: jalbertomr/lab…"   

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-machine ssh myvm1 "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
exit status 1
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker container ls
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                  NAMES
43dd42c0b410        miapp80             "python app.py"     21 minutes ago      Up 21 minutes       0.0.0.0:4000->80/tcp   distracted_joliot
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker rm 43dd42c0b410
Error response from daemon: You cannot remove a running container 43dd42c0b410b7bd80a1efb3f194036e34b0fe234e68e27fde530dc96c2ff99a. Stop the container before attempting removal or force remove
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stop 43dd42c0b410
43dd42c0b410
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker rm 43dd42c0b410
43dd42c0b410
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                        PORTS               NAMES
d8ddfcc73815        abba73b6a912        "python app.py"     29 minutes ago      Exited (137) 28 minutes ago                       inspiring_antonelli
b1ec5b08a2b7        abba73b6a912        "python app.py"     31 minutes ago      Exited (0) 31 minutes ago                         reverent_noether
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ history |grep deploy
  781  docker stack deploy -c docker-compose.yml miserviciolab
  785  docker-machine ssh myvm1 "docker stack deploy -c docker-compose.yml miserviciolab"
  813  docker-machine ssh myvm1 "docker stack deploy --with-registry-auth -c docker-compose.yml miserviciolab"
  815  docker-machine ssh myvm1 "docker stack deploy --with-registry-auth -c docker-compose.yml miserviciolab"
  904  docker stack deploy -c docker-compose.yml miserviciolab
  915  docker-machine ssh myvm1 "docker deploy -c docker-compose.yml miserviciolab"
  928  docker stack deploy -c docker-compose.yml miserviciolab
 1001  docker-machine ssh myvm1 "docker stack deploy -c docker-compose.yml miserviciolab"
 1019  docker stack deploy -c docker-compose.yml miserviciolab
 1093  docker-machine ssh myvm1 "docker stack deploy --with-registry-auth -c docker-compose.yml miserviciolab2"
 1096  docker-machine ssh myvm1 "docker stack deploy --with-registry-auth -c docker-compose.yml miserviciolab2"
 1129  docker-machine ssh myvm1 "docker stack deploy -c docker-compose.yml miserviciolab3"
 1194  docker stack deploy -c docker-compose.yml miserviciolab4
 1232  docker-machine ssh myvm1 "docker stack deploy -c docker-compose.yml miserviciolab"
 1266  docker stack deploy -c docker-compose.yml miappcompose80
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker image ls
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
jalbertomr/lab1     miapp80             2052c9c9a9ea        24 minutes ago      131MB
miapp80             latest              2052c9c9a9ea        24 minutes ago      131MB
jalbertomr/lab1     python_app_1        68e8339a3346        3 days ago          131MB
python_app          latest              68e8339a3346        3 days ago          131MB
python              2.7-slim            ca96bab3e2aa        2 weeks ago         120MB
hello-world         latest              fce289e99eb9        5 months ago        1.84kB
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker run -p 80:80 jalbertomr/lab1:miapp80
 * Serving Flask app "app" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on http://0.0.0.0:80/ (Press CTRL+C to quit)
172.17.0.1 - - [25/Jun/2019 18:06:22] "GET / HTTP/1.1" 200 -

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker stack deploy -c docker-compose.yml miapp80swarm"
Creating network miapp80swarm_webnet
Creating service miapp80swarm_web
failed to create service miapp80swarm_web: Error response from daemon: rpc error: code = InvalidArgument desc = port '5000' is already in use by service 'miserviciolab_web' (by4doymokvqeau7d5t40kpwz0) as an ingress port
exit status 1
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ history | grep scp
  784  docker-machine scp docker-compose.yml myvm1:~
  806  docker-machine scp docker-compose.yml myvm1:~
  935  docker-machine scp .  myvm1:~
  937  docker-machine scp
  938  docker-machine scp -r  .  myvm1:~
 1059  docker-machine scp docker-compose.yml myvm1:~
 1072  docker-machine scp -r docker-compose.yml myvm1:~
 1074  docker-machine scp
 1115  docker-machine scp  docker-compose.yml myvm1:~
 1139  docker-machine scp -r  docker-compose.yml myvm1:~
 1192  docker-machine scp . myvm1:~
 1231  docker-machine scp docker-compose.yml myvm1:~
 1299  history | grep scp
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine scp docker-compose.yml myvm1:~
docker-compose.yml                                                                                                                 100%  394   566.5KB/s   00:00    
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker stack deploy -c docker-compose.yml miapp80swarm"
Creating service miapp80swarm_web
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stack ps miapp80swarm
nothing found in stack: miapp80swarm
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker stack ps miapp80swarm"
ID                  NAME                     IMAGE                           NODE                DESIRED STATE       CURRENT STATE             ERROR                              PORTS
jd512uqnkm7f        miapp80swarm_web.1       jalbertomr/lab_1:python_app_1   myvm1               Running             Preparing 9 seconds ago                                      
ssowos7d469s         \_ miapp80swarm_web.1   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 10 seconds ago   "No such image: jalbertomr/lab…"   
vdhtlnnul8m2         \_ miapp80swarm_web.1   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 14 seconds ago   "No such image: jalbertomr/lab…"   
5lnmc2hnb93w         \_ miapp80swarm_web.1   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 26 seconds ago   "No such image: jalbertomr/lab…"   
i9p3xq3owcce         \_ miapp80swarm_web.1   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 30 seconds ago   "No such image: jalbertomr/lab…"   
nkv59bjwyssq        miapp80swarm_web.2       jalbertomr/lab_1:python_app_1   myvm1               Running             Preparing 8 seconds ago                                      
gxkfk0dyeavz         \_ miapp80swarm_web.2   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 10 seconds ago   "No such image: jalbertomr/lab…"   
pi90ifnhi4ir         \_ miapp80swarm_web.2   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 13 seconds ago   "No such image: jalbertomr/lab…"   
3nefank7k018         \_ miapp80swarm_web.2   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 19 seconds ago   "No such image: jalbertomr/lab…"   
caxfle1jxzyy         \_ miapp80swarm_web.2   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 28 seconds ago   "No such image: jalbertomr/lab…"   
ax1p6fms4e1r        miapp80swarm_web.3       jalbertomr/lab_1:python_app_1   myvm1               Running             Preparing 7 seconds ago                                      
3mwf18eejvpx         \_ miapp80swarm_web.3   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 9 seconds ago    "No such image: jalbertomr/lab…"   
t93p3w9t987w         \_ miapp80swarm_web.3   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 13 seconds ago   "No such image: jalbertomr/lab…"   
g5662s5vpq5y         \_ miapp80swarm_web.3   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 21 seconds ago   "No such image: jalbertomr/lab…"   
gcwxujnkg74k         \_ miapp80swarm_web.3   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 30 seconds ago   "No such image: jalbertomr/lab…"   
va1q3sg96h1j        miapp80swarm_web.4       jalbertomr/lab_1:python_app_1   myvm1               Running             Preparing 5 seconds ago                                      
2fygplcdd10r         \_ miapp80swarm_web.4   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 7 seconds ago    "No such image: jalbertomr/lab…"   
j74av20pw9q9         \_ miapp80swarm_web.4   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 11 seconds ago   "No such image: jalbertomr/lab…"   
guua0wh4ibpu         \_ miapp80swarm_web.4   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 15 seconds ago   "No such image: jalbertomr/lab…"   
kahzzsjtsptz         \_ miapp80swarm_web.4   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 30 seconds ago   "No such image: jalbertomr/lab…"   
pp2mn91z66km        miapp80swarm_web.5       jalbertomr/lab_1:python_app_1   myvm1               Running             Preparing 7 seconds ago                                      
jw25xdlybzfu         \_ miapp80swarm_web.5   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 9 seconds ago    "No such image: jalbertomr/lab…"   
wgihyrnwf5uf         \_ miapp80swarm_web.5   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 13 seconds ago   "No such image: jalbertomr/lab…"   
pgnkyfp01qbm         \_ miapp80swarm_web.5   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 20 seconds ago   "No such image: jalbertomr/lab…"   
kv9hl38wjfj0         \_ miapp80swarm_web.5   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 30 seconds ago   "No such image: jalbertomr/lab…"   
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker stack ps miapp80swarm" | more
ID                  NAME                     IMAGE                           NODE                DESIRED STATE       CURRENT STATE             ERROR                 
             PORTS
yas1ctzj67oc        miapp80swarm_web.1       jalbertomr/lab_1:python_app_1   myvm2               Running             Preparing 6 seconds ago                         
             
i8z1xtphh017         \_ miapp80swarm_web.1   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 9 seconds ago    "No such image: jalber
tomr/lab…"   
jd512uqnkm7f         \_ miapp80swarm_web.1   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 12 seconds ago   "No such image: jalber
tomr/lab…"   
ssowos7d469s         \_ miapp80swarm_web.1   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 24 seconds ago   "No such image: jalber
tomr/lab…"   
vdhtlnnul8m2         \_ miapp80swarm_web.1   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 29 seconds ago   "No such image: jalber
tomr/lab…"   
vidgy4aoo24b        miapp80swarm_web.2       jalbertomr/lab_1:python_app_1   myvm2               Running             Preparing 7 seconds ago                         
             
nex0li5d2hcp         \_ miapp80swarm_web.2   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 10 seconds ago   "No such image: jalber
tomr/lab…"   
nkv59bjwyssq         \_ miapp80swarm_web.2   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 12 seconds ago   "No such image: jalber
tomr/lab…"   
gxkfk0dyeavz         \_ miapp80swarm_web.2   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 24 seconds ago   "No such image: jalber
tomr/lab…"   
pi90ifnhi4ir         \_ miapp80swarm_web.2   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 28 seconds ago   "No such image: jalber
tomr/lab…"   
xgq0nfs9ho0m        miapp80swarm_web.3       jalbertomr/lab_1:python_app_1   myvm2               Running             Preparing 6 seconds ago                         
             
a1sxe89wftmp         \_ miapp80swarm_web.3   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 9 seconds ago    "No such image: jalber
tomr/lab…"   
ax1p6fms4e1r         \_ miapp80swarm_web.3   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 11 seconds ago   "No such image: jalber
tomr/lab…"   
3mwf18eejvpx         \_ miapp80swarm_web.3   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 24 seconds ago   "No such image: jalber
tomr/lab…"   
t93p3w9t987w         \_ miapp80swarm_web.3   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 27 seconds ago   "No such image: jalber
tomr/lab…"   
p3l3sft3jakc        miapp80swarm_web.4       jalbertomr/lab_1:python_app_1   myvm2               Running             Preparing 6 seconds ago                         
             
ol2u43hc3tof         \_ miapp80swarm_web.4   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 9 seconds ago    "No such image: jalber
tomr/lab…"   
va1q3sg96h1j         \_ miapp80swarm_web.4   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 11 seconds ago   "No such image: jalber
tomr/lab…"   
2fygplcdd10r         \_ miapp80swarm_web.4   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 22 seconds ago   "No such image: jalber
tomr/lab…"   
j74av20pw9q9         \_ miapp80swarm_web.4   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 26 seconds ago   "No such image: jalber
tomr/lab…"   
lrd4b8mbmb0v        miapp80swarm_web.5       jalbertomr/lab_1:python_app_1   myvm2               Running             Preparing 5 seconds ago                         
             
ukv3k1l9hkct         \_ miapp80swarm_web.5   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 9 seconds ago    "No such image: jalber
tomr/lab…"   
pp2mn91z66km         \_ miapp80swarm_web.5   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 11 seconds ago   "No such image: jalber
tomr/lab…"   
jw25xdlybzfu         \_ miapp80swarm_web.5   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 24 seconds ago   "No such image: jalber
tomr/lab…"   
wgihyrnwf5uf         \_ miapp80swarm_web.5   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 27 seconds ago   "No such image: jalber
tomr/lab…"   
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ls
NAME    ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER     ERRORS
myvm1   -        virtualbox   Running   tcp://192.168.99.107:2376           v18.09.6   
myvm2   -        virtualbox   Running   tcp://192.168.99.108:2376           v18.09.6   
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ curl http://192.168.99.107
curl: (7) Failed to connect to 192.168.99.107 port 80: Connection refused
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ curl http://localhost
curl: (7) Failed to connect to localhost port 80: Connection refused
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "cat docker-compose.yml" | more
version: "3"
services:
  web:
    #remplazar username/repo:tag con el nombre y imagen
    #image: username/repo:tag
    image: jalbertomr/lab_1:python_app_1
    deploy:
      replicas: 5
      resources:
        limits:
          cpus: "0.1"
          memory: 50M
      restart_policy:
        condition: on-failure
    ports:
      - "4000:80"
    networks:
      - webnet
networks:
  webnet:
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "nano docker-compose.yml" | more
bash: nano: command not found
exit status 127
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "rm docker-compose.yml" | more
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "ls" | more
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine scp docker-compose.yml myvm1:~
docker-compose.yml                                                                                                                 100%  394   419.0KB/s   00:00    
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "ls" | more
docker-compose.yml
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker stack deploy -c docker-compose.yml miapp80swarm"
Updating service miapp80swarm_web (id: zmah2smmiuknd7ey5zdty62dp)
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 ls
NAME    ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER     ERRORS
myvm1   -        virtualbox   Running   tcp://192.168.99.107:2376           v18.09.6   
myvm2   -        virtualbox   Running   tcp://192.168.99.108:2376           v18.09.6   
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ curl http://192.168.99.107
curl: (7) Failed to connect to 192.168.99.107 port 80: Connection refused
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-machine ssh myvm1 "docker stack ps miapp80swarm" | more
ID                  NAME                     IMAGE                           NODE                DESIRED STATE       CURRENT STATE                 ERROR             
                 PORTS
uifvrrz577ru        miapp80swarm_web.1       jalbertomr/lab_1:python_app_1   myvm2               Running             Preparing 5 seconds ago                         
                 
rr2kz4u7btue         \_ miapp80swarm_web.1   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 5 seconds ago        "No such image: ja
lbertomr/lab…"   
ab8o19cq4nk3         \_ miapp80swarm_web.1   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 15 seconds ago       "No such image: ja
lbertomr/lab…"   
vdlgfxrbgm4t         \_ miapp80swarm_web.1   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 25 seconds ago       "No such image: ja
lbertomr/lab…"   
7cs835d2woqo         \_ miapp80swarm_web.1   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 38 seconds ago       "No such image: ja
lbertomr/lab…"   
oxur1a6lhuae        miapp80swarm_web.2       jalbertomr/lab_1:python_app_1   myvm1               Running             Preparing 15 seconds ago                        
                 
6mtz4ugcutti         \_ miapp80swarm_web.2   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 15 seconds ago       "No such image: ja
lbertomr/lab…"   
zhhufsxbcz00         \_ miapp80swarm_web.2   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected 30 seconds ago       "No such image: ja
lbertomr/lab…"   
jhh31x283dlf         \_ miapp80swarm_web.2   jalbertomr/lab_1:python_app_1   myvm2               Shutdown            Rejected about a minute ago   "No such image: ja
lbertomr/lab…"   
jutrrjgrk90g         \_ miapp80swarm_web.2   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected about a minute ago   "No such image: ja
lbertomr/lab…"   
kuwr3bqtbjem        miapp80swarm_web.3       jalbertomr/lab_1:python_app_1   myvm2               Running             Preparing 9 seconds ago                         
                 
5qn5tpj6y932         \_ miapp80swarm_web.3   jalbertomr/lab_1:python_app_1   myvm1               Shutdown            Rejected 9 seconds ago        "No such image: ja
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker image ls
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
miapp80             latest              2052c9c9a9ea        35 minutes ago      131MB
jalbertomr/lab1     miapp80             2052c9c9a9ea        35 minutes ago      131MB
python_app          latest              68e8339a3346        3 days ago          131MB
jalbertomr/lab1     python_app_1        68e8339a3346        3 days ago          131MB
python              2.7-slim            ca96bab3e2aa        2 weeks ago         120MB
hello-world         latest              fce289e99eb9        5 months ago        1.84kB
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine scp docker-compose.yml myvm1:~
docker-compose.yml                                                                                                                 100%  389   537.5KB/s   00:00    
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "cat docker-compose.yml" | more
version: "3"
services:
  web:
    #remplazar username/repo:tag con el nombre y imagen
    #image: username/repo:tag
    image: jalbertomr/lab_1:myapp80
    deploy:
      replicas: 5
      resources:
        limits:
          cpus: "0.1"
          memory: 50M
      restart_policy:
        condition: on-failure
    ports:
      - "4000:80"
    networks:
      - webnet
networks:
  webnet:
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "cat docker-compose.yml" | more
version: "3"
services:
  web:
    #remplazar username/repo:tag con el nombre y imagen
    #image: username/repo:tag
    image: jalbertomr/lab_1:myapp80
    deploy:
      replicas: 5
      resources:
        limits:
          cpus: "0.1"
          memory: 50M
      restart_policy:
        condition: on-failure
    ports:
      - "4000:80"
    networks:
      - webnet
networks:
  webnet:
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine scp docker-compose.yml myvm1:~
docker-compose.yml                                                                                                                 100%  387   326.7KB/s   00:00    
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "cat docker-compose.yml" | more
version: "3"
services:
  web:
    #remplazar username/repo:tag con el nombre y imagen
    #image: username/repo:tag
    image: jalbertomr/lab_1:myapp80
    deploy:
      replicas: 5
      resources:
        limits:
          cpus: "0.1"
          memory: 50M
      restart_policy:
        condition: on-failure
    ports:
      - "80:80"
    networks:
      - webnet
networks:
  webnet:
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker stack deploy -c docker-compose.yml miapp80swarm"
Updating service miapp80swarm_web (id: zmah2smmiuknd7ey5zdty62dp)
image jalbertomr/lab_1:myapp80 could not be accessed on a registry to record
its digest. Each node will access jalbertomr/lab_1:myapp80 independently,
possibly leading to different nodes running different
versions of the image.

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ curl http://192.168.99.107
curl: (7) Failed to connect to 192.168.99.107 port 80: Connection refused
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ls
NAME    ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER     ERRORS
myvm1   -        virtualbox   Running   tcp://192.168.99.107:2376           v18.09.6   
myvm2   -        virtualbox   Running   tcp://192.168.99.108:2376           v18.09.6   
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ curl http://192.168.99.108
curl: (7) Failed to connect to 192.168.99.108 port 80: Connection refused
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ curl http://192.168.99.107
curl: (7) Failed to connect to 192.168.99.107 port 80: Connection refused
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ curl http://localhost
curl: (7) Failed to connect to localhost port 80: Connection refused
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker ps -a
CONTAINER ID        IMAGE                     COMMAND             CREATED             STATUS                         PORTS               NAMES
8da8147a69c9        jalbertomr/lab1:miapp80   "python app.py"     15 minutes ago      Exited (0) 14 minutes ago                          adoring_blackburn
d8ddfcc73815        abba73b6a912              "python app.py"     About an hour ago   Exited (137) 45 minutes ago                        inspiring_antonelli
b1ec5b08a2b7        abba73b6a912              "python app.py"     About an hour ago   Exited (0) About an hour ago                       reverent_noether
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ curl http://localhost:4000
curl: (7) Failed to connect to localhost port 4000: Connection refused
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ curl http://localhost:5000
curl: (7) Failed to connect to localhost port 5000: Connection refused
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker ps -a
CONTAINER ID        IMAGE                     COMMAND             CREATED             STATUS                         PORTS               NAMES
8da8147a69c9        jalbertomr/lab1:miapp80   "python app.py"     15 minutes ago      Exited (0) 14 minutes ago                          adoring_blackburn
d8ddfcc73815        abba73b6a912              "python app.py"     About an hour ago   Exited (137) 45 minutes ago                        inspiring_antonelli
b1ec5b08a2b7        abba73b6a912              "python app.py"     About an hour ago   Exited (0) About an hour ago                       reverent_noether
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker container ls
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker rm 8da8147a69c9
8da8147a69c9
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker rm d8ddfcc73815
d8ddfcc73815
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker rm b1ec5b08a2b7
b1ec5b08a2b7
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker stack deploy -c docker-compose.yml miapp80swarm"
Updating service miapp80swarm_web (id: zmah2smmiuknd7ey5zdty62dp)
image jalbertomr/lab_1:myapp80 could not be accessed on a registry to record
its digest. Each node will access jalbertomr/lab_1:myapp80 independently,
possibly leading to different nodes running different
versions of the image.

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ls
NAME    ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER     ERRORS
myvm1   -        virtualbox   Running   tcp://192.168.99.107:2376           v18.09.6   
myvm2   -        virtualbox   Running   tcp://192.168.99.108:2376           v18.09.6   
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ curl http://192.168.99.107
curl: (7) Failed to connect to 192.168.99.107 port 80: Connection refused
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stack ps miapp80swarm
nothing found in stack: miapp80swarm
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker service ls"
ID                  NAME                MODE                REPLICAS            IMAGE                           PORTS
zmah2smmiukn        miapp80swarm_web    replicated          0/5                 jalbertomr/lab_1:myapp80        *:80->80/tcp
by4doymokvqe        miserviciolab_web   replicated          0/5                 jalbertomr/lab_1:python_app_1   *:5000->4000/tcp
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker service ls
ID                  NAME                 MODE                REPLICAS            IMAGE                           PORTS
rjwk48zepee5        miappcompose80_web   replicated          0/5                 jalbertomr/lab_1:python_app_1   *:4000->80/tcp
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker service 

Usage: docker service COMMAND

Manage services

Commands:
  create      Create a new service
  inspect     Display detailed information on one or more services
  logs        Fetch the logs of a service or task
  ls          List services
  ps          List the tasks of one or more services
  rm          Remove one or more services
  rollback    Revert changes to a service's configuration
  scale       Scale one or multiple replicated services
  update      Update a service

Run 'docker service COMMAND --help' for more information on a command.
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker service rm rjwk48zepee5
rjwk48zepee5
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker service ls
ID                  NAME                MODE                REPLICAS            IMAGE               PORTS
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker service ls"
ID                  NAME                MODE                REPLICAS            IMAGE                           PORTS
zmah2smmiukn        miapp80swarm_web    replicated          0/5                 jalbertomr/lab_1:myapp80        *:80->80/tcp
by4doymokvqe        miserviciolab_web   replicated          0/5                 jalbertomr/lab_1:python_app_1   *:5000->4000/tcp
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker service rm by4doymokvqe"
by4doymokvqe
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker service ls"
ID                  NAME                MODE                REPLICAS            IMAGE                      PORTS
zmah2smmiukn        miapp80swarm_web    replicated          0/5                 jalbertomr/lab_1:myapp80   *:80->80/tcp
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker service rm zmah2smmiukn"
zmah2smmiukn
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker service ls"
ID                  NAME                MODE                REPLICAS            IMAGE               PORTS
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker stack deploy -c docker-compose.yml miapp80swarm"
Creating service miapp80swarm_web
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
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 miapp80swarm
nothing found in stack: miapp80swarm
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker stack ps miapp80swarm"
ID                  NAME                     IMAGE                      NODE                DESIRED STATE       CURRENT STATE             ERROR                              PORTS
oh05q3f4amwk        miapp80swarm_web.1       jalbertomr/lab_1:myapp80   myvm2               Running             Preparing 8 seconds ago                                      
r9wfcmzsd215         \_ miapp80swarm_web.1   jalbertomr/lab_1:myapp80   myvm1               Shutdown            Rejected 9 seconds ago    "No such image: jalbertomr/lab…"   
hpeewlwfrwp5         \_ miapp80swarm_web.1   jalbertomr/lab_1:myapp80   myvm2               Shutdown            Rejected 13 seconds ago   "No such image: jalbertomr/lab…"   
7zec5rnf5a6u         \_ miapp80swarm_web.1   jalbertomr/lab_1:myapp80   myvm1               Shutdown            Rejected 31 seconds ago   "No such image: jalbertomr/lab…"   
f721cakcpnd8         \_ miapp80swarm_web.1   jalbertomr/lab_1:myapp80   myvm1               Shutdown            Rejected 37 seconds ago   "No such image: jalbertomr/lab…"   
3d916cb1d8ke        miapp80swarm_web.2       jalbertomr/lab_1:myapp80   myvm2               Ready               Preparing 4 seconds ago                                      
bxzgxjn1dqt9         \_ miapp80swarm_web.2   jalbertomr/lab_1:myapp80   myvm1               Shutdown            Rejected 8 seconds ago    "No such image: jalbertomr/lab…"   
pw2jn24pr5lj         \_ miapp80swarm_web.2   jalbertomr/lab_1:myapp80   myvm1               Shutdown            Rejected 10 seconds ago   "No such image: jalbertomr/lab…"   
d6izux8b1amj         \_ miapp80swarm_web.2   jalbertomr/lab_1:myapp80   myvm2               Shutdown            Rejected 17 seconds ago   "No such image: jalbertomr/lab…"   
yh7cm2iici3t         \_ miapp80swarm_web.2   jalbertomr/lab_1:myapp80   myvm1               Shutdown            Rejected 28 seconds ago   "No such image: jalbertomr/lab…"   
hy13ldjdj7rr        miapp80swarm_web.3       jalbertomr/lab_1:myapp80   myvm2               Running             Preparing 8 seconds ago                                      
klczp98cqzp5         \_ miapp80swarm_web.3   jalbertomr/lab_1:myapp80   myvm1               Shutdown            Rejected 9 seconds ago    "No such image: jalbertomr/lab…"   
ryv2ywwudo1l         \_ miapp80swarm_web.3   jalbertomr/lab_1:myapp80   myvm2               Shutdown            Rejected 14 seconds ago   "No such image: jalbertomr/lab…"   
25e2mthpj6a6         \_ miapp80swarm_web.3   jalbertomr/lab_1:myapp80   myvm2               Shutdown            Rejected 30 seconds ago   "No such image: jalbertomr/lab…"   
2ohcnrz333dj         \_ miapp80swarm_web.3   jalbertomr/lab_1:myapp80   myvm1               Shutdown            Rejected 37 seconds ago   "No such image: jalbertomr/lab…"   
tvzt2orx9hsc        miapp80swarm_web.4       jalbertomr/lab_1:myapp80   myvm2               Running             Preparing 7 seconds ago                                      
d0md20ugpd6j         \_ miapp80swarm_web.4   jalbertomr/lab_1:myapp80   myvm1               Shutdown            Rejected 9 seconds ago    "No such image: jalbertomr/lab…"   
sznn1knrij45         \_ miapp80swarm_web.4   jalbertomr/lab_1:myapp80   myvm2               Shutdown            Rejected 12 seconds ago   "No such image: jalbertomr/lab…"   
nkojmz3v0c3c         \_ miapp80swarm_web.4   jalbertomr/lab_1:myapp80   myvm1               Shutdown            Rejected 28 seconds ago   "No such image: jalbertomr/lab…"   
fni0i30oxlxm         \_ miapp80swarm_web.4   jalbertomr/lab_1:myapp80   myvm2               Shutdown            Rejected 35 seconds ago   "No such image: jalbertomr/lab…"   
3ella04m40bx        miapp80swarm_web.5       jalbertomr/lab_1:myapp80   myvm2               Running             Preparing 9 seconds ago                                      
tev1qsihrbv0         \_ miapp80swarm_web.5   jalbertomr/lab_1:myapp80   myvm1               Shutdown            Rejected 9 seconds ago    "No such image: jalbertomr/lab…"   
z643wk7ijzu3         \_ miapp80swarm_web.5   jalbertomr/lab_1:myapp80   myvm2               Shutdown            Rejected 17 seconds ago   "No such image: jalbertomr/lab…"   
k0408fuyv2lu         \_ miapp80swarm_web.5   jalbertomr/lab_1:myapp80   myvm1               Shutdown            Rejected 32 seconds ago   "No such image: jalbertomr/lab…"   
o59gi11orggm         \_ miapp80swarm_web.5   jalbertomr/lab_1:myapp80   myvm2               Shutdown            Rejected 33 seconds ago   "No such image: jalbertomr/lab…"   
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker service ls"
ID                  NAME                MODE                REPLICAS            IMAGE                      PORTS
jqy99qs9jm5d        miapp80swarm_web    replicated          0/5                 jalbertomr/lab_1:myapp80   *:80->80/tcp
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ curl http://localhost
curl: (7) Failed to connect to localhost port 80: Connection refused
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ls
NAME    ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER     ERRORS
myvm1   -        virtualbox   Running   tcp://192.168.99.107:2376           v18.09.6   
myvm2   -        virtualbox   Running   tcp://192.168.99.108:2376           v18.09.6   
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ curl http://192.168.99.107
curl: (7) Failed to connect to 192.168.99.107 port 80: Connection refused
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker service ls"
ID                  NAME                MODE                REPLICAS            IMAGE                      PORTS
jqy99qs9jm5d        miapp80swarm_web    replicated          0/5                 jalbertomr/lab_1:myapp80   *:80->80/tcp
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker service rm jqy99qs9jm5d"
jqy99qs9jm5d
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker login"
Error: Cannot perform an interactive login from a non TTY device
exit status 1
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ eval $(docker-machine env myvm1)
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "cat docker-compose.yml"
version: "3"
services:
  web:
    #remplazar username/repo:tag con el nombre y imagen
    #image: username/repo:tag
    image: jalbertomr/lab_1:myapp80
    deploy:
      replicas: 5
      resources:
        limits:
          cpus: "0.1"
          memory: 50M
      restart_policy:
        condition: on-failure
    ports:
      - "80:80"
    networks:
      - webnet
networks:
  webnet:
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker image ls
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ history | grep build
  436  docker build --tag=python_app .
  492  docker build --tag=contpython1 .
 1246  docker build --tab=myApp .
 1258  docker build --tag=miapp80 .
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ ls
app.py  app.py.save  docker-compose.yml  Dockerfile  myvm1  requirements.txt  testRedis.py
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ cat Dockerfile
# Usa runtime oficial de Python como imagen principal
FROM python:2.7-slim
# El directorio de trabajo sera /app
WORKDIR /app
# Copia el contenido actual del directorio a /app
COPY . /app
# Instala los paquetes necesarios especificados en requirements.txt
RUN pip install --trusted-host pypi.python.org -r requirements.txt
#Declara puerto 4000 de este contenedor disponible al mundo externo
EXPOSE 80
# Define variable de ambiente
ENV NAME Mundito (env var definido en Dockerfile)
# Ejecuta app.py cuando el contenedor se carge
CMD ["python","app.py"] 
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker build --tag=miapp80 ."
unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /home/docker/Dockerfile: no such file or directory
exit status 1
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker build --tag=miapp80 .
Sending build context to Docker daemon   42.5kB
Step 1/7 : FROM python:2.7-slim
2.7-slim: Pulling from library/python
fc7181108d40: Pull complete 
8c60b810a35a: Pull complete 
d207b275197c: Pull complete 
63184f224d60: Pull complete 
Digest: sha256:1405fa2f8e9a232e2f60cafbb2b06ca2f1e0f577f4b4c397c361d6dba59fd24e
Status: Downloaded newer image for python:2.7-slim
 ---> ca96bab3e2aa
Step 2/7 : WORKDIR /app
 ---> Running in f2f585c8d5bd
Removing intermediate container f2f585c8d5bd
 ---> 34e1cd70accb
Step 3/7 : COPY . /app
 ---> 58ce88b6a8d7
Step 4/7 : RUN pip install --trusted-host pypi.python.org -r requirements.txt
 ---> Running in a35aa1712f13
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting flask (from -r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/9a/74/670ae9737d14114753b8c8fdf2e8bd212a05d3b361ab15b44937dfd40985/Flask-1.0.3-py2.py3-none-any.whl (92kB)
Collecting redis (from -r requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/ac/a7/cff10cc5f1180834a3ed564d148fb4329c989cbb1f2e196fc9a10fa07072/redis-3.2.1-py2.py3-none-any.whl (65kB)
Collecting itsdangerous>=0.24 (from flask->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/76/ae/44b03b253d6fade317f32c24d100b3b35c2239807046a4c953c7b89fa49e/itsdangerous-1.1.0-py2.py3-none-any.whl
Collecting Jinja2>=2.10 (from flask->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/1d/e7/fd8b501e7a6dfe492a433deb7b9d833d39ca74916fa8bc63dd1a4947a671/Jinja2-2.10.1-py2.py3-none-any.whl (124kB)
Collecting Werkzeug>=0.14 (from flask->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/9f/57/92a497e38161ce40606c27a86759c6b92dd34fcdb33f64171ec559257c02/Werkzeug-0.15.4-py2.py3-none-any.whl (327kB)
Collecting click>=5.1 (from flask->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/fa/37/45185cb5abbc30d7257104c434fe0b07e5a195a6847506c074527aa599ec/Click-7.0-py2.py3-none-any.whl (81kB)
Collecting MarkupSafe>=0.23 (from Jinja2>=2.10->flask->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/fb/40/f3adb7cf24a8012813c5edb20329eb22d5d8e2a0ecf73d21d6b85865da11/MarkupSafe-1.1.1-cp27-cp27mu-manylinux1_x86_64.whl
Installing collected packages: itsdangerous, MarkupSafe, Jinja2, Werkzeug, click, flask, redis
Successfully installed Jinja2-2.10.1 MarkupSafe-1.1.1 Werkzeug-0.15.4 click-7.0 flask-1.0.3 itsdangerous-1.1.0 redis-3.2.1
Removing intermediate container a35aa1712f13
 ---> b444ee2c196d
Step 5/7 : EXPOSE 80
 ---> Running in bc9bbaea84af
Removing intermediate container bc9bbaea84af
 ---> 12dbfaaf684f
Step 6/7 : ENV NAME Mundito (env var definido en Dockerfile)
 ---> Running in ddc2e8d8ef71
Removing intermediate container ddc2e8d8ef71
 ---> 31154a743309
Step 7/7 : CMD ["python","app.py"]
 ---> Running in 28e3d40ce81a
Removing intermediate container 28e3d40ce81a
 ---> d2100bef18ac
Successfully built d2100bef18ac
Successfully tagged miapp80:latest
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker image ls
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
miapp80             latest              d2100bef18ac        7 seconds ago       131MB
python              2.7-slim            ca96bab3e2aa        2 weeks ago         120MB
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker tag miapp80 jalbertomr/lab_1:myapp80
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker image ls
REPOSITORY          TAG                 IMAGE ID            CREATED              SIZE
jalbertomr/lab_1    myapp80             d2100bef18ac        About a minute ago   131MB
miapp80             latest              d2100bef18ac        About a minute ago   131MB
python              2.7-slim            ca96bab3e2aa        2 weeks ago          120MB
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker push jalbertomr/lab_1:myapp80
The push refers to repository [docker.io/jalbertomr/lab_1]
27e54efa0ae0: Pushed 
2ce0fd3abfc0: Pushed 
b830289cfd4a: Pushed 
a212ef9c5ee1: Mounted from library/python 
a47fa5565167: Mounted from library/python 
658556256f47: Mounted from library/python 
cf5b3c6798f7: Mounted from library/python 
myapp80: digest: sha256:51dd3e40a89ddbd5dd1c0f8ec69f9b68698ae656f71910fbca30e5cfe5ae4ec1 size: 1789
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker service ls"
ID                  NAME                MODE                REPLICAS            IMAGE               PORTS
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker stack deploy -c docker-compose.yml miapp80swarm"
Creating service miapp80swarm_web
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker service ls"
ID                  NAME                MODE                REPLICAS            IMAGE                      PORTS
6iaqa2kkymfi        miapp80swarm_web    replicated          2/5                 jalbertomr/lab_1:myapp80   *:80->80/tcp
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker stack ps miapp80swarm"
ID                  NAME                 IMAGE                      NODE                DESIRED STATE       CURRENT STATE                  ERROR               PORTS
ken7pp3chvn3        miapp80swarm_web.1   jalbertomr/lab_1:myapp80   myvm2               Running             Preparing about a minute ago                       
jeo4u5kbfevz        miapp80swarm_web.2   jalbertomr/lab_1:myapp80   myvm1               Running             Running about a minute ago                         
uf16ko0tyvsq        miapp80swarm_web.3   jalbertomr/lab_1:myapp80   myvm2               Running             Preparing about a minute ago                       
w4onta1rgb57        miapp80swarm_web.4   jalbertomr/lab_1:myapp80   myvm2               Running             Preparing about a minute ago                       
lqkpjpxdsu7g        miapp80swarm_web.5   jalbertomr/lab_1:myapp80   myvm1               Running             Running about a minute ago                         
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ls
NAME    ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER     ERRORS
myvm1   *        virtualbox   Running   tcp://192.168.99.107:2376           v18.09.6   
myvm2   -        virtualbox   Running   tcp://192.168.99.108:2376           v18.09.6   
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ curl http://192.168.99.107
<h3>Hola variable entorno NAME=Mundito (env var definido en Dockerfile)!</h3><b>Hostname:</b> 88ff8a043b45<br/><b>Visitas:</b> <i>No hay conexion con Redis, contador deshabilidado</i>bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker stack ps miapp80swarm"
ID                  NAME                 IMAGE                      NODE                DESIRED STATE       CURRENT STATE             ERROR               PORTS
ken7pp3chvn3        miapp80swarm_web.1   jalbertomr/lab_1:myapp80   myvm2               Running             Preparing 2 minutes ago                       
jeo4u5kbfevz        miapp80swarm_web.2   jalbertomr/lab_1:myapp80   myvm1               Running             Running 2 minutes ago                         
uf16ko0tyvsq        miapp80swarm_web.3   jalbertomr/lab_1:myapp80   myvm2               Running             Preparing 2 minutes ago                       
w4onta1rgb57        miapp80swarm_web.4   jalbertomr/lab_1:myapp80   myvm2               Running             Preparing 2 minutes ago                       
lqkpjpxdsu7g        miapp80swarm_web.5   jalbertomr/lab_1:myapp80   myvm1               Running             Running 2 minutes ago                         
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker service ls"
ID                  NAME                MODE                REPLICAS            IMAGE                      PORTS
6iaqa2kkymfi        miapp80swarm_web    replicated          2/5                 jalbertomr/lab_1:myapp80   *:80->80/tcp
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ curl http://192.168.99.108
<h3>Hola variable entorno NAME=Mundito (env var definido en Dockerfile)!</h3><b>Hostname:</b> 88ff8a043b45<br/><b>Visitas:</b> <i>No hay conexion con Redis, contador deshabilidado</i> 


Finalmente, despues de tanto traqueteo.




Desde la VM1 tenemos
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "ls"
docker-compose.yml
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker ps"
CONTAINER ID        IMAGE                      COMMAND             CREATED             STATUS              PORTS               NAMES
625a43fbab3e        jalbertomr/lab_1:myapp80   "python app.py"     2 hours ago         Up 2 hours          80/tcp              miapp80swarm_web.2.jeo4u5kbfevzdzxekxt74yj2d
88ff8a043b45        jalbertomr/lab_1:myapp80   "python app.py"     2 hours ago         Up 2 hours          80/tcp              miapp80swarm_web.5.lqkpjpxdsu7gbgf4r7xiyskkr
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker image ls"
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
jalbertomr/lab_1    myapp80             d2100bef18ac        2 hours ago         131MB
miapp80             latest              d2100bef18ac        2 hours ago         131MB
python              2.7-slim            ca96bab3e2aa        2 weeks ago         120MB

Desde la VM2 tememos
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm2 "ls"
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm2 "docker ps"
CONTAINER ID        IMAGE                      COMMAND             CREATED             STATUS              PORTS               NAMES
652e473ee437        jalbertomr/lab_1:myapp80   "python app.py"     2 hours ago         Up 2 hours          80/tcp              miapp80swarm_web.1.ken7pp3chvn3g3on0k26bjunn
47791cbec346        jalbertomr/lab_1:myapp80   "python app.py"     2 hours ago         Up 2 hours          80/tcp              miapp80swarm_web.3.uf16ko0tyvsqyr6t3ddayzrt5
3b26242c089b        jalbertomr/lab_1:myapp80   "python app.py"     2 hours ago         Up 2 hours          80/tcp              miapp80swarm_web.4.w4onta1rgb57jubtfi1de1x8k
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm2 "docker image ls"
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
jalbertomr/lab_1    <none>              d2100bef18ac        2 hours ago         131MB

Ahora vamos a bajar el servicio y limpiar.

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stack ls
NAME                SERVICES            ORCHESTRATOR
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ eval $(docker-machine env myvm1)
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stack ls
NAME                SERVICES            ORCHESTRATOR
miapp80swarm        1                   Swarm
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker stack rm miapp80swarm
Removing service miapp80swarm_web
Removing network miapp80swarm_webnet
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker service ls
ID                  NAME                MODE                REPLICAS            IMAGE               PORTS
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker service ls"
ID                  NAME                MODE                REPLICAS            IMAGE               PORTS
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ eval $(docker-machine env -u)
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine stop $(docker-machine ls -q)
Stopping "myvm1"...
Stopping "myvm2"...
Machine "myvm1" was stopped.
Machine "myvm2" was stopped.
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine rm $(docker-machine ls -q)
About to remove myvm1, myvm2
WARNING: This action will delete both local reference and remote instance.
Are you sure? (y/n): y
Successfully removed myvm1
Successfully removed myvm2
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ 

Posteriormente despues de cerrar todo, reiniciamos todo, solo para tener el contenido del comando docker inspect.

bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ docker-machine ssh myvm1 "docker inspect miserviciolab_web"
[
    {
        "ID": "38vxxfbyga6jgohfule15v3l7",
        "Version": {
            "Index": 19
        },
        "CreatedAt": "2019-06-26T20:47:26.845408466Z",
        "UpdatedAt": "2019-06-26T20:47:26.847166261Z",
        "Spec": {
            "Name": "miserviciolab_web",
            "Labels": {
                "com.docker.stack.image": "jalbertomr/lab_1:myapp80",
                "com.docker.stack.namespace": "miserviciolab"
            },
            "TaskTemplate": {
                "ContainerSpec": {
                    "Image": "jalbertomr/lab_1:myapp80@sha256:51dd3e40a89ddbd5dd1c0f8ec69f9b68698ae656f71910fbca30e5cfe5ae4ec1",
                    "Labels": {
                        "com.docker.stack.namespace": "miserviciolab"
                    },
                    "Privileges": {
                        "CredentialSpec": null,
                        "SELinuxContext": null
                    },
                    "StopGracePeriod": 10000000000,
                    "DNSConfig": {},
                    "Isolation": "default"
                },
                "Resources": {
                    "Limits": {
                        "NanoCPUs": 100000000,
                        "MemoryBytes": 52428800
                    }
                },
                "RestartPolicy": {
                    "Condition": "on-failure",
                    "Delay": 5000000000,
                    "MaxAttempts": 0
                },
                "Placement": {
                    "Platforms": [
                        {
                            "Architecture": "amd64",
                            "OS": "linux"
                        }
                    ]
                },
                "Networks": [
                    {
                        "Target": "kr3sl6xovx6qo8l3g8fg0jigz",
                        "Aliases": [
                            "web"
                        ]
                    }
                ],
                "ForceUpdate": 0,
                "Runtime": "container"
            },
            "Mode": {
                "Replicated": {
                    "Replicas": 5
                }
            },
            "UpdateConfig": {
                "Parallelism": 1,
                "FailureAction": "pause",
                "Monitor": 5000000000,
                "MaxFailureRatio": 0,
                "Order": "stop-first"
            },
            "RollbackConfig": {
                "Parallelism": 1,
                "FailureAction": "pause",
                "Monitor": 5000000000,
                "MaxFailureRatio": 0,
                "Order": "stop-first"
            },
            "EndpointSpec": {
                "Mode": "vip",
                "Ports": [
                    {
                        "Protocol": "tcp",
                        "TargetPort": 80,
                        "PublishedPort": 80,
                        "PublishMode": "ingress"
                    }
                ]
            }
        },
        "Endpoint": {
            "Spec": {
                "Mode": "vip",
                "Ports": [
                    {
                        "Protocol": "tcp",
                        "TargetPort": 80,
                        "PublishedPort": 80,
                        "PublishMode": "ingress"
                    }
                ]
            },
            "Ports": [
                {
                    "Protocol": "tcp",
                    "TargetPort": 80,
                    "PublishedPort": 80,
                    "PublishMode": "ingress"
                }
            ],
            "VirtualIPs": [
                {
                    "NetworkID": "308rdktiijk63e68u6y4gkvk4",
                    "Addr": "10.255.0.4/16"
                },
                {
                    "NetworkID": "kr3sl6xovx6qo8l3g8fg0jigz",
                    "Addr": "10.0.0.2/24"
                }
            ]
        }
    }
]
bext@bext-VPCF13WFX:~/DockerAppConfig/DockerSampleApp$ 

eot

No hay comentarios:

Publicar un comentario