Why ?
@caarlos0
http://carlosbecker.com
http://facebook.com/joinvillegladiators
Why ?
Intro
AuFS
$ docker pull bobrik/image-cleaner
Pulling repository bobrik/image-cleaner
28b7cd17052f: Download complete
511136ea3c5a: Download complete
a5b60fe97da5: Download complete
9bff7ebd6f58: Download complete
5381e678f99a: Download complete
Status: Downloaded newer image for bobrik/image-cleaner:latest
Docker Registry
https://hub.docker.com/r/caarlos0
FROM alpine:3.2
ENV GOPATH=/gopath \
src=/gopath/src/github.com/caarlos0/getantibody
WORKDIR $SRC
ADD . $SRC
EXPOSE 3000
RUN apk add -U git go && \
go get -v -d ./... && \
go get -v github.com/GeertJohan/go.rice/rice && \
/gopath/bin/rice embed-go -i ./server && \
go install -v ./... && \
apk del git go && \
rm -rf /gopath/src /gopath/pkg /var/cache/apk/*
CMD /gopath/bin/server
$ docker build -t caarlos0/getantibody .
# ...
$ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
caarlos0/getantibody latest f4a56952e5ee 32 seconds ago 29.4 MB
alpine latest 31f630c65071 3 months ago 5.254 MB
$ docker push caarlos0/getantibody
The push refers to a repository [caarlos0/getantibody] (len: 1)
10904c7197a8: Image already exists
6e78c20b9ce2: Image successfully pushed
5d1f7744cdb9: Image successfully pushed
86b5bbfc869e: Image successfully pushed
04a7a01f893f: Image successfully pushed
31f630c65071: Image successfully pushed
Digest: sha256:85ed3eb7ce8a478bbbed7744854f18073b6efd142db05482b6ac893d34719bae
machine:
services:
- docker
python:
version: 2.7
dependencies:
pre:
- pip install awsebcli
deployment:
production:
branch: master
commands:
- docker login -e "$DOCKER_EMAIL" -u "$DOCKER_USER" -p "$DOCKER_PASS"
- docker build -t "caarlos0/getantibody:$CIRCLE_BUILD_NUM" .
- docker push "caarlos0/getantibody:$CIRCLE_BUILD_NUM"
- sed -i'' -e "s;%BUILD_NUM%;$CIRCLE_BUILD_NUM;g" ./.deploy/Dockerrun.aws.json
- cd .deploy && eb init -r us-east-1 getantibody
- cd .deploy && eb deploy -l $CIRCLE_BUILD_NUM
Vantagens/Desvantagens
Em dev/sandbox
- Ambiente "limpo" para builds
- circle
- travis
- shippable
- ...
- Economizar $$
- grid selenium
- Distribuição livre de dependencias
- docker run image
- Sem wikis de como subir o projeto
- Config do ambiente junto com o app
- Cluster local (ex: MongoDB)
Em produção
- Padrão de distribuição (e livre de deps)
- Formato único
- Script simples (dependendo de onde)
Deploy... como, onde?
- Elastic Container Service?
- Elastic Beanstalk?
- Bluemix?
- Heroku?
- IAAS (EC2, DigitalOcean, ...)?
- IAAS Cluster (CoreOS, Kubernetes, ...)?
- Self-hosted PAAS?
- ???????
Conclusão
Docker é legal?
é!
Devo usar em dev?
Provavelmente sim!
Devo usar em prod?
Depende...
Foca no problema que você quer resolver!
Se for só pelo Hype, não use!
Se não existe um problema atualmente, não use!
"KISS"
Keep it simple, sir!
Obrigado!
Dúvidas?
http://www.meetup.com/Docker-Joinville/
Why Docker?
By Carlos A. Becker
Why Docker?
- 3,953