Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Docker para Humanos

Docker para Humanos

Workshop cascudo demais com o grande amigo RafaPG (https://www.linkedin.com/in/girolineto/) abordando sobre Docker, primeiros passos para quem quer andar na cauda da baleia!

Opensanca

March 14, 2017
Tweet

More Decks by Opensanca

Other Decks in Programming

Transcript

  1. O que são containers • Containers vs VMs • Isolamento

    ◦ Rede ◦ Storage ◦ Processo ◦ Memória ◦ ...
  2. Imagens e Containers kernel - bootfs base image alpine base

    image ubuntu image layer a1 image layer a2 container layer image layer b1 image layer b2' image layer b2'' container layer container layer container layer Container A Container B Container C Container D |---- read only ----| r+w
  3. Instalando o Docker Engine Linux curl -sSL https://get.docker.com/ | sh

    Windows https://docs.docker.com/docker-for-windows/install/ Mac https://docs.docker.com/docker-for-mac/install/
  4. Hello Sea! $ docker run hello-world Unable to find image

    'hello-world:latest' locally latest: Pulling from library/hello-world 78445dd45222: Pull complete Digest: sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7 Status: Downloaded newer image for hello-world:latest E o que aconteceu com esse container?
  5. Ciclo de Vida do Container $ docker ps $ docker

    ps -a $ docker logs [container name] $ docker rm [container name]
  6. Um shell dentro do container $ docker run -it -p

    8080:80 ubuntu bash # apt-get update # apt-get install nginx -y # service nginx start
  7. Dockerfile FROM ubuntu:latest RUN apt-get update && apt-get install nginx

    -y EXPOSE 80 WORKDIR / ENTRYPOINT service nginx start && tail -f /var/log/nginx/access.log Imagem base + Comandos + Portas + Diretório Padrão + Script Inicial docker run -it -p 8080:80 [build]
  8. Tag e Push $ docker tag [build] [aquele que não

    se fala o nome]:latest $ docker push [seu_repo]/docker-p-humanos-nginx:latest
  9. E agora? Documentação do Docker: • Dockerfile • Docker run

    • Inspect • Logs Outras ferramentas • Docker Swarm • Docker Compose • Kubernetes • Mesos / Marathon