Docker Workshop

Revisión 2020 - Parte 3/4

Filesystem
storage

Esfímero

"todos los cambios se perderán"

Persistencia

"los datos que deben perdurar requieren configuración/tratamiento"

{

commit

build

}

Storage: root

Docker Host

AUFS

BTRFS

Overlay2

devicemapper
LVM

ZFS

Storage Driver

/

  • RO
  • RW  [ CoW ]

Storage: mount

Docker Host

file.txt

folder/

-v path-to-file:file-in-container

Storage: volume

Docker Host

NFS:

AWS EFS

Object storage:

S3

Swift

Blocks storage:

AWS EBS

Cepth

Volume drivers

volume

  • anónimos
-v /path-into-container
  • con nombre
-v nombre-volume:/path-into-container

Storage: tmpfs

Docker Host

-tmpfs /path-into-container

Storage: service

Docker Host

SQL
DataBase

NoSQL
DataBase

S3
Objet Storage

NFS

SSHfs

ElastiCache
Redis

AWS
Data Pipeline

data
ETL

Redes de
contenedores

Contenedores cerrados

--network none

Docker Host

lan

Contenedores abiertos

--network host

Docker Host

lan

Sin aislamiento

NO recomendado

Contenedores bridge

--network bridge
docker network

Docker Host

lan

docker0

br-X

vethX

ethX

mi-red

DNS

dhcp

backend

DNS

dhcp

Contenedores juntos

--network none --name {cont-name}
--network container:{cont-name}

Docker Host

lan

tunX

tunX

Volúmenes:

   persistencia a los datos

Redes:

   bridge   (default)

Resúmen

Múltiples contenedores

creando todo

docker network create wp 

mkdir -p wp/database wp/html; cd wp

docker run \
-e MYSQL_ROOT_PASSWORD=rootpass \
--name wpdatabase \
--network wp \
-v "$PWD/database":/var/lib/mysql \
-d mariadb:latest

docker run \
-e WORDPRESS_DB_PASSWORD=rootpass \
-e WORDPRESS_DB_HOST=wpdatabase \
--name wpservice \
--network wp \
-p 8081:80 \
-v "$PWD/html":/var/www/html \
-d wordpress

componiendo

version: '3'

services:

  wpdb:
    image: mariadb:latest
    container_name: wpdb
    volumes:
      - $PWD/database:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=rootpass
    networks:
      - wp

  wordpress:
    depends_on:
      - wpdb
    image: wordpress
    container_name: wordpress
    networks:
      - wp
    ports:
      - "8081:80"
    volumes:
      - $PWD/html:/var/www/html
    environment:
      - WORDPRESS_DB_PASSWORD=rootpass
      - WORDPRESS_DB_HOST=wpdb

networks:
  wp:   

... a seguir

Parte 4/4:

componiendo ...  cont!

orquestadores (kubernetes)