Compose, Machine, Swarm y CoreOS

Yohan Graterol @yograterol
Múltiples contenedores es una molestia
- Crear Dockerfile
- Bajar la imagen desde el registry.
- Configurar crear contenedores.
- ...
- ...
Múltiples contenedores es una molestia


Docker Compose soluciona el problema

Instalación Docker Compose
$ sudo pip install -U docker-compose
o
# curl -L https://github.com/docker/compose/releases/
download/1.2.0/docker-compose-`uname -s`-`uname -m`
> /usr/local/bin/docker-compose
# chmod +x /usr/local/bin/docker-compose
docker-compose.yml
app:
build: .
command: python app.py
ports:
- "3000:3000"
https://github.com/yograterol/compose-platzi-demo
docker-compose.yml
$ cd <ruta_proyecto>
$ sudo docker-compose up
Recreating composedemo_app_1...
Attaching to composedemo_app_1
Docker Machine
- Permite crear y administrar host con Docker.
- Compatible con hypervisors, cloud o private cloud.
- BETA, no disponible para uso en producción.
- Fácil instalacion en Windows, OS X y Linux.
Docker Machine

Docker Machine

Docker Machine

Instalación de Docker Machine (Linux)
$ wget https://github.com/docker/machine/releases/
download/v0.2.0/docker-machine_linux-amd64
$ sudo mv docker-machine_linux-amd64 /usr/bin/docker-machine
$ sudo chmod +x /usr/bin/docker-machine
Uso de Docker Machine
$ docker-machine create --driver virtualbox platzidev
$ eval "$(docker-machine env platzidev)"
$ docker ps
CONTAINER ID IMAGE COMMAND
Docker Swarm

Docker Swarm

Docker Swarm

Docker Swarm no se instala
$ sudo docker pull swarm
$ sudo docker run --rm swarm create
6856663cdefdec325839a4b9e2de38e1
$ docker -H tcp://0.0.0.0:2375 info
Containers: 0
Nodes: 3
agent-2: 172.31.40.110:2375
└ Containers: 0
└ Reserved CPUs: 0 / 1
└ Reserved Memory: 0 B / 514.5 MiB
agent-1: 172.31.40.109:2375
└ Containers: 0
└ Reserved CPUs: 0 / 1
└ Reserved Memory: 0 B / 514.5 MiB
agent-0: 172.31.40.108:2375
└ Containers: 0
└ Reserved CPUs: 0 / 1
└ Reserved Memory: 0 B / 514.5 MiB

Qué es CoreOS?
- Systemd.
- Docker.
- Etcd.
- Fleet
- Cloudinit
Systemd
- Reemplazo a init.
- Permite administrar los daemons en Linux .
- Implementado en muchas distribuciones de Linux.
Etcd
- Key/Value store.
- Rápido, Escalable.
- Service Discovery.
Fleet
- Lazo entre Systemd y Etcd.
- Funciona a bajo nivel.
- Objetivo: Mejorar la orquestación de un cluster basado en CoreOS.
Cloudinit
#cloud-config
coreos:
units:
- name: etcd.service
command: start
users:
- name: core
passwd: $1$allJZawX$00S5T756I5PGdQga5qhqv1
write_files:
- path: /etc/resolv.conf
content: |
nameserver 192.0.2.2
nameserver 192.0.2.3
deck
By Yohan Graterol
deck
- 906