How to easy deploy app into any cloud

How to easy deploy app into any cloud

Using docker to deploy app into production.

55d57afc217d360cd3aad3e2a8d4e5a0?s=128

Ladislav Prskavec

March 09, 2016
Tweet

Transcript

  1. How to easy deploy app into any cloud IPEX Meetup

    Brno, 9.3.2016 1
  2. Ladislav Prskavec 4 Twitter: @abtris 4 Blog: http://blog.prskavec.net 4 Talking

    and mentoring Docker since 2013 IPEX Meetup Brno, 9.3.2016 2
  3. IPEX Meetup Brno, 9.3.2016 3

  4. What's Docker? IPEX Meetup Brno, 9.3.2016 4

  5. Analogy from logistics IPEX Meetup Brno, 9.3.2016 5

  6. Goods, wares IPEX Meetup Brno, 9.3.2016 6

  7. Containers IPEX Meetup Brno, 9.3.2016 7

  8. Why Docker? IPEX Meetup Brno, 9.3.2016 8

  9. Fast and scalable IPEX Meetup Brno, 9.3.2016 9

  10. Build once, run anywhere IPEX Meetup Brno, 9.3.2016 10

  11. Configure once, run anywhere IPEX Meetup Brno, 9.3.2016 11

  12. Example of using Docker 4 build documentation in Sphinx with

    latex support 4 executing code in many different programming languages without requiring a single compiler or script interpreter on your machine - docker exec 4 running gui app in docker at linux IPEX Meetup Brno, 9.3.2016 12
  13. Example of using Docker 4 development without install ing many

    tools at local machine 4 Vagrant, Otto dev 4 continues integration using docker 4 Jenkins, TravisCI, CircleCI 4 DevOps platform for build, deploy and manage apps across any cloud IPEX Meetup Brno, 9.3.2016 13
  14. IPEX Meetup Brno, 9.3.2016 14

  15. Docker Engine IPEX Meetup Brno, 9.3.2016 15

  16. Docker Engine IPEX Meetup Brno, 9.3.2016 16

  17. VM vs Docker IPEX Meetup Brno, 9.3.2016 17

  18. Containers and images docker run hello-world IPEX Meetup Brno, 9.3.2016

    18
  19. Docker Remote API 4 client & server in Docker 4

    docker ps 4 docker build 4 docker push/pull 4 docker run/stop 4 docker inspect IPEX Meetup Brno, 9.3.2016 19
  20. Docker lifecycle 4 a build produces an immutable image 4

    a container is as instance of the image IPEX Meetup Brno, 9.3.2016 20
  21. Docker lifecycle IPEX Meetup Brno, 9.3.2016 21

  22. Container lifecycle IPEX Meetup Brno, 9.3.2016 22

  23. Dockerfile FROM alpine:3.3 RUN apk add --no-cache curl ENV DOCKER_BUCKET

    get.docker.com ENV DOCKER_VERSION 1.10.2 ENV DOCKER_SHA256 3fcac4f30e1c1a346c52ba33104175ae4ccbd9b9dbb947f56a0a32c9e401b768 RUN curl -fSL "https://${DOCKER_BUCKET}/builds/Linux/x86_64/docker-$DOCKER_VERSION" -o /usr/local/bin/docker \ && echo "${DOCKER_SHA256} /usr/local/bin/docker" | sha256sum -c - \ && chmod +x /usr/local/bin/docker COPY docker-entrypoint.sh /usr/local/bin/ ENTRYPOINT ["docker-entrypoint.sh"] CMD ["sh"] IPEX Meetup Brno, 9.3.2016 23
  24. DockerHub IPEX Meetup Brno, 9.3.2016 24

  25. IPEX Meetup Brno, 9.3.2016 25

  26. Docker tools IPEX Meetup Brno, 9.3.2016 26

  27. Docker compose 4 defining and running multi- container applications with

    Docker IPEX Meetup Brno, 9.3.2016 27
  28. docker-compose.yml web: build: . ports: - "5000:5000" volumes: - .:/code

    links: - redis redis: image: redis IPEX Meetup Brno, 9.3.2016 28
  29. Docker machine 4 Machine lets you create Docker hosts on

    your computer, on cloud providers, and inside your own data center. 4 part of Docker toolbox 4 replacement for boot2docker IPEX Meetup Brno, 9.3.2016 29
  30. Docker swarm 4 Docker Swarm is native clustering for Docker.

    4 Swarm serves the standard Docker API, so any tool which already communicates with a Docker daemon can use Swarm to transparently scale to multiple hosts: Dokku, Compose, Krane, Flynn, Deis, DockerUI, Shipyard, Drone, Jenkins... and, of course, the Docker client itself. IPEX Meetup Brno, 9.3.2016 30
  31. Kitematic 4 desktop GUI for Docker 4 Mac and Windows

    only IPEX Meetup Brno, 9.3.2016 31
  32. Docker Trusted Registry (DTR) 4 private dedicated image registry IPEX

    Meetup Brno, 9.3.2016 32
  33. Docker Cloud 4 Deploy and scale any application to your

    cloud in seconds, with just a few clicks IPEX Meetup Brno, 9.3.2016 33
  34. IPEX Meetup Brno, 9.3.2016 34

  35. IPEX Meetup Brno, 9.3.2016 35

  36. Docker isn't just Docker Inc IPEX Meetup Brno, 9.3.2016 36

  37. Alternatives for Docker Registry 4 Amazon EC2 Container Registry 4

    Google Container Registry 4 Quay Enterprise 4 Artifactory 4 Nexus 4 Bitnami Container Images for Docker (beta) IPEX Meetup Brno, 9.3.2016 37
  38. Yours private registry 4 storage at S3 docker run \

    -d \ -p 5000:5000 \ --restart=always \ --name registry \ registry:2 IPEX Meetup Brno, 9.3.2016 38
  39. Open Container ekosystem IPEX Meetup Brno, 9.3.2016 39

  40. IPEX Meetup Brno, 9.3.2016 40

  41. IPEX Meetup Brno, 9.3.2016 41

  42. wercker.yml example # The container definition we want to use

    for developing our app box: golang # Defining the dev pipeline dev: steps: - internal/watch: code: | go build ./... ./source reload: true IPEX Meetup Brno, 9.3.2016 42
  43. IPEX Meetup Brno, 9.3.2016 43

  44. Building a Go app for scratch containers build: box: google/golang

    steps: # Test the project - script: name: go test code: go test ./... # Statically build the project - script: name: go build code: CGO_ENABLED=0 go build -a -ldflags '-s' -installsuffix cgo -o app . # Copy binary to a location that gets passed along to the deploy pipeline - script: name: copy binary code: cp app "$WERCKER_OUTPUT_DIR" IPEX Meetup Brno, 9.3.2016 44
  45. Docker in AWS 4 Elastic Beanstalk 4 EC2 Container Service

    (ECS) 4 EC2 with Swarm, Mesos or Kubernetes IPEX Meetup Brno, 9.3.2016 45
  46. IPEX Meetup Brno, 9.3.2016 46

  47. IPEX Meetup Brno, 9.3.2016 47

  48. Apache Messos 4 Scalability to 10,000s of nodes 4 Fault-tolerant

    replicated master and slaves using ZooKeeper 4 Support for Docker containers 4 Native isolation between tasks with Linux Containers 4 Multi-resource scheduling (memory, CPU, disk, and ports) 4 Java, Python and C++ APIs for developing new parallel applications 4 Web UI for viewing cluster state IPEX Meetup Brno, 9.3.2016 48
  49. Notes at the end 4 don't use Docker as VM

    4 build & production images 4 tag every image using in production (not just latest) 4 big difference between languages (NodeJS & Go) 4 don't use latest Docker versions in production 4 try use dockerlint for your Dockerfiles IPEX Meetup Brno, 9.3.2016 49
  50. Credits 4 boat-containers.jpg 2 4 computer-scrap.jpg [^3] 4 vm-vs-docker.png [^4]

    4 docker logos [^5] 4 formule_one.jpg [^6] 2 https://www.flickr.com/photos/41864721@N00/3451530961/ [^3]: https://www.flickr.com/photos/7362086@N02/2019666131/ [^4]: http://www.jayway.com/wp-content/uploads/2015/03/vm-vs-docker.png [^5]: https://www.docker.com/brand-guidelines IPEX Meetup Brno, 9.3.2016 50