Thiago Zilli Sarmento
Innovation enthusiast, Blockchain master and Techleader
Dev-Talk 15min @Mediaresponse
CENTOS
#$ sudo yum install docker
#$ sudo service docker start
#$ sudo chkconfig docker on
#$ docker info
#$ docker version
UBUNTU >= 14-10
#$ sudo apt-get install -y docker.io
#$ docker info
#$ docker -v
OSX
https://www.docker.com/toolbox
Running fist container
$ docker ps -a
$ docker run grumpy:cat
$ docker ps
$ docker ps -a
$ docker run -it grumpy:cat /bin/bash
$ ls
$ pwd
$ hostname
List images
$ docker images
List container running
$ docker ps -a
Pull someone image
$ docker pull name-repo/tag
Dockfile
FROM ubuntu:latest
MAINTAINER Thiago Zilli <tzilli@corp.mediaresponse.com>
RUN apt-get -y install apache2
CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]
docker build --no-cache -t thiagozs/grumpy:thecat .
docker build -t thiagozs/grumpy:thecat .
Generate image
Running a image
docker run -d -p 1883:1883 --restart=always -t thiagozs/grumpy:thecat
Stop a image
docker stop container-id
Start a image
docker start container-id
-p |--port == 1883:1883
Parameters
local container
tcp / udp - others
Stop all instances (Up)
$ sudo docker rm $(sudo docker ps -a | grep Up | awk '{print $1}')
Remove all instances stoped (Exited)
$sudo docker rm $(sudo docker ps -a | grep Exited | awk '{print $1}')
Remove empty instances (none)
$sudo docker rmi -f $(sudo docker images | grep '<none>'| awk '{print $3}')
Remove all images except ubuntu image.
$sudo docker rmi -f $(sudo docker images | grep -v 'ubuntu' | grep -v 'IMAGE'| awk '{print $3}')
or zsh
Documentation
https://docs.docker.com/swarm/
More Tools
Dokku, Docker Compose, Krane, Jenkins, Rancher ... and others!
Docker-composer (swarm)
Commands
$docker-compose -f compose-example.yml up -d
... little more
$vim compose-example.yml
nginx:
image: nginx
links:
- app1:app1
- app2:app2
- app3:app3
ports:
- "80:80"
app1:
image: thiagozs/grumpy:thecat
app2:
image: thiagozs/grumpy:thecat
app3:
image: thiagozs/grumpy:thecat
Thiago Zilli Sarmento
twitter: @thiagozs
e-mail: thiago.zilli@gmail.com
November 27, 2015
By Thiago Zilli Sarmento
Simple docker presentation