Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

BEEVA | Introducción a Docker

984 views

Published on

"Introducción a Docker".
Global Mentor Day UPM. Noviembre 2016.
Ángel Barrera, Ingeniero de Software en BEEVA.
Encuéntranos en www.beeva.com y labs.beeva.com

Published in: Engineering
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/qURD } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/qURD } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/qURD } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/qURD } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/qURD } ......................................................................................................................... Download doc Ebook here { https://soo.gd/qURD } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

BEEVA | Introducción a Docker

  1. 1. Introducción a Docker Escuela Técnica Superior de Ingenieros de Telecomunicación (UPM) @ Madrid (Spain) Global Mentor Day @ UPM. Miércoles 16 de noviembre de 2016
  2. 2. About me: Ignacio Vaquero ● Licenciado en Ingeniería de Telecomunicación por la ETSIT UPM ● Actualmente Ingeniero DevOps en DATIO Big Data ● Anteriormente he trabajado también como DevOps en bq ● Trabajando con Docker algo más de 1 año ● Contacto: ivaquero@datiobd.com @igvaquero18 @igvaquero18 #LearnDocker
  3. 3. About me: Ángel Barrera Sánchez ● Ingeniero de Software en BEEVA @ BBVA. ● He trabajado en consultoras grandes y startups. ● Actualmente estamos adaptando una arquitectura monolítica SOAP hacia Microservicios restful. ● Contacto: angel.barrera@beeva.com @angelbarrera92 @angelbarrera92 #LearnDocker
  4. 4. Índice ● Instalación Docker y Docker Compose ● Nuestro primer contenedor ● Desplegando una aplicación web con Docker ● Docker Compose: Aplicación completa de votos #LearnDocker
  5. 5. Instalación ● Instalación Docker y Docker Compose ○ Docker: Linux, macOS, Windows ○ Docker Compose ○ Editor de texto (Opcional) ● Nuestro primer contenedor ● Desplegando una aplicación web con Docker ● Docker Compose: Aplicación completa de votos #LearnDocker https://github.com/docker/labs/tree/master/beginner
  6. 6. Instalación: Docker ● Linux ○ The Hard Way: https://docs.docker.com/engine/installation/linux/ ○ The Easy Way: Lanzar comando en shell: https://get.docker.com ● macOS y Windows ○ Docker for Mac o Docker for Windows ○ ALTERNATIVA: Docker Toolbox (para equipos/SO antiguos). #LearnDocker
  7. 7. Instalación: Docker compose ● Linux ○ The Hard Way: https://docs.docker.com/compose/install/ ○ The Python way: ■ $ pip install docker-compose ○ The bash way: ■ $ curl -L "https://github.com/docker/compose/releases/download/1.8.1/docke r-compose-$(uname -s)-$(uname -m)" > /usr/local/bin/docker-compose ■ $ chmod +x /usr/local/bin/docker-compose ● macOS y Windows ○ Docker toolbox ya incorpora docker compose #LearnDocker
  8. 8. Instalación: Docker ● ¿Por qué tengo que poner sudo? https://docs.docker.com/engine/installation/linux/ubuntulinux/#/create-a-docker-group #LearnDocker
  9. 9. Instalación: Hola mundo ● Hello World! docker run hello-world #LearnDocker
  10. 10. Instalación: Editor de texto (Opcional) ● Editor de texto: ○ Atom: https://atom.io ○ Sublime: https://www.sublimetext.com ○ Visual Studio: https://www.visualstudio.com/es/ #LearnDocker
  11. 11. Nuestro primer contenedor ● Instalación Docker y Docker Compose ● Nuestro primer contenedor ● Desplegando una aplicación web con Docker ● Docker Compose: Aplicación completa de votos #LearnDocker
  12. 12. Repositorio de imágenes - Docker Hub ● Docker Hub es un servicio de registro basado en la nube para crear y entregar contenedores de servicio o aplicaciones. ● Provee un recurso centralizado para el descubrimiento de contenedores, distribución, control de cambios, colaboración de equipos y automatización de flujos de trabajo #LearnDocker
  13. 13. Descargando la imagen ● Imagen: Alpine Linux ○ docker pull alpine : Bajamos la imagen del Docker Hub. ● Una imagen es el sistema de ficheros y configuración que se usa para lanzar uno o varios contenedores. Un contenedor es una instancia de una imagen en ejecución. ● Un usuario puede crear una imagen con un programa ejecutable y subirla al Docker Hub. ● Otro usuario puede descargar la imagen y lanzar un contenedor basado en esa imagen, de manera que se ejecute el programa dentro del contenedor. ● La imagen es como una plantilla para ejecutar contenedores idénticos. ● docker images : Listado de imágenes descargadas en nuestro ordenador. #LearnDocker
  14. 14. Lanzando contenedores docker run alpine ls -l Invocamos el cliente de Docker Ejecutamos el comando run de Docker, que lanza un contenedor en nuestro ordenador basándose en una imagen Nombre de la imagen que queremos lanzar Comando que lanzamos dentro del contenedor (programa + argumentos) #LearnDocker
  15. 15. Lanzando contenedores ● Otros comandos: ○ docker run alpine echo hello from alpine ○ docker run alpine /bin/sh ○ docker run -it alpine /bin/sh ■ ls -l ■ uname -a ■ ... ■ exit ○ docker ps -a ○ docker run --help #LearnDocker ○ docker kill $(docker ps -aq) ○ docker rm $(docker ps -aq)
  16. 16. Otros comandos #LearnDocker docker --help
  17. 17. Terminología ● Images - The file system and configuration of our application which are used to create containers. To find out more about a Docker image, run docker inspect alpine. In the demo above, you used the docker pull command to download the alpine image. When you executed the command docker run hello-world, it also did a docker pull behind the scenes to download the hello-world image. ● Containers - Running instances of Docker images — containers run the actual applications. A container includes an application and all of its dependencies. It shares the kernel with other containers, and runs as an isolated process in user space on the host OS. You created a container using docker run which you did using the alpine image that you downloaded. A list of running containers can be seen using the docker ps command. ● Docker daemon - The background service running on the host that manages building, running and distributing Docker containers. ● Docker client - The command line tool that allows the user to interact with the Docker daemon. ● Docker Hub - A registry of Docker images. You can think of the registry as a directory of all available Docker images. You'll be using this later in this tutorial. #LearnDocker
  18. 18. Aplicación web dockerizada (Random Kittens Web App) ● Instalación Docker y Docker Compose ● Nuestro primer contenedor ● Desplegando una aplicación web con Docker ● Docker Compose: Aplicación completa de votos #LearnDocker
  19. 19. Aplicación web dockerizada (Random Kittens Web App) ● Objetivo: Crearemos una aplicación web escrita en python con flask, la dockerizaremos escribiendo un Dockerfile y la ejecutaremos en nuestros PCs. El resultado, una web con gifs aleatorio de gatitos #LearnDocker
  20. 20. Aplicación web dockerizada (Random Kittens Web App) ● Pasos: ○ Todo el tutorial está en: ■ https://github.com/docker/labs/blob/master/beginner/chapters/webapps.md#23-create-your-first-image ○ El código fuente lo encontramos en: ■ https://github.com/docker/labs/tree/master/beginner/flask-app #LearnDocker
  21. 21. Labo time! https://goo.gl/XQvAjX #LearnDocker Ojo. A partir del punto 2.3
  22. 22. Aplicación web dockerizada (Random Kittens Web App) ● Análisis del Dockerfile: #LearnDocker FROM: Indica la imagen base a utilizar. RUN: Ejecución de comandos. Añade el gestor de paquetes de python y lo actualiza. COPY: Inserta ficheros desde el host hasta la imagen. En este caso el fichero de requisitos de python. RUN: Ejecución de la instalación de los requisitos de python. COPY: Añade la aplicación y la plantilla HTML. EXPOSE: Expone el puerto que se va a utilizar para que salga del contenedor y sea accesible desde nuestro host. CMD: Comando de arranque del contenedor.
  23. 23. Aplicación web dockerizada (Random Kittens Web App) ● Build de la imagen #LearnDocker El comando docker build es bastante simple, coge de forma opcional una etiqueta con el flag/argumento -t y el directorio que contiene el Dockerfile como último argumento posicional (‘.’ = directorio actual) $ docker build -t learndocker/myfirstapp .
  24. 24. Aplicación web dockerizada (Random Kittens Web App) ● Ejecución del contenedor #LearnDocker El último paso de esta sección es ejecutar la imagen y ver si realmente funciona. $ docker run -p 8888:5000 --name myfirstapp learndocker/myfirstapp Abrid el navegador y comprobad que la aplicación se ejecuta correctamente: http://localhost:8888 Pulsad F5 para ver mas gifs de Gatitos ● Parada del contenedor $ docker stop myfirstapp $ docker rm myfirstapp $ docker rm -f myfirstappO
  25. 25. Aplicación completa de votos ● Instalación Docker y Docker Compose ● Nuestro primer contenedor ● Desplegando una aplicación web con Docker ● Docker Compose: Aplicación completa de votos #LearnDocker
  26. 26. Aplicación completa de votos ● Objetivo: Crear una aplicación de votos basada en microservicios ● Los microservicios son múltiples contenedores de Docker que cumplen una única función y colaboran entre ellos para lograr un objetivo común. ● Pueden ser de diversas tecnologías (Node, Python, .Net) y se comunican a través de redes de Docker. ● Docker Compose nos permite definir y ejecutar una aplicación multi-contenedor. #LearnDocker
  27. 27. Esquema Docker Compose docker-compose up -d #LearnDocker
  28. 28. Requisitos ● docker-compose version > 1.6 ● Utilizaremos la versión 2 del formato Docker Compose que introduce nuevas abstracciones: ○ Servicios ○ Volúmenes ○ Redes ● Git: https://git-scm.com/downloads #LearnDocker
  29. 29. Redes en Docker ● Permiten comunicación entre todos los contenedores pertenecientes a dicha red, a través del nombre del contenedor y sin necesidad de exponer puertos. ● Permiten aislamiento con los contenedores no pertenecientes a dicha red. ● Un contenedor puede pertenecer a una o más redes, y comunicarse con todos los contenedores de todas las redes a las que pertenezca. docker network create miRed docker network ls docker run -d --name wordpress --net miRed wordpress docker run -d --name mysql --net miRed mysql docker network inspect miRed #LearnDocker
  30. 30. Volúmenes en Docker ● Permiten persistencia de información del contenedor. ● Se montan en un path específico del contenedor (por ejemplo, /var/lib/mysql). ● Puede crearse un volumen nuevo... ● O puede montarse un directorio de nuestro PC en el contenedor... docker volume create miVol docker run -d -v miVol:/var/lib/mysql mysql:latest docker run -d -v $(pwd)/db:/var/lib/mysql mysql:latest ● En este último caso, la información creada y modificada en el contenedor se refleja en el directorio de nuestro PC y viceversa. mi directorio El directorio en el contenedor #LearnDocker
  31. 31. Docker Compose ● Ejemplo de aplicación: ○ Wordpress con BBDD MySQL ○ Se comunican por una red llamada wordpress_net ○ MySQL monta un volumen llamado data en el directorio /var/lib/mysql del contenedor. ○ Se pueden pasar variables de entorno globales al contenedor (útil para setear configuración). ● Código: ○ https://github.com/igvaquero18/MentorDay-examples #LearnDocker
  32. 32. Labo time! https://goo.gl/jdkFvL #LearnDocker Desde el punto 3.1 hasta el 3.2.3 (ambos incluídos).
  33. 33. Challenge #LearnDocker Solo un voto por sesión. ¿Alguien puede solucionarlo?
  34. 34. Solución ● Reseteamos la cookie que guarda nuestro voto en el fichero app.py:
  35. 35. Challenge Cambiar las opciones disponibles en la votación… Sólo con Docker Compose!
  36. 36. Solución ● En el fichero app.py, se leen las opciones disponibles de dos variables de entorno llamadas OPTION_A y OPTION_B. Las seteamos en el fichero docker-compose.yml
  37. 37. Preguntas #LearnDocker
  38. 38. Nuevo training site oficial http://training.docker.com/category/docker-mentor-week #LearnDocker

×