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

How to easy deploy app into any cloud

How to easy deploy app into any cloud

Using docker to deploy app into production.

Ladislav Prskavec

March 09, 2016
Tweet

More Decks by Ladislav Prskavec

Other Decks in Technology

Transcript

  1. 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
  2. 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
  3. 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
  4. 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
  5. 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
  6. 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
  7. docker-compose.yml web: build: . ports: - "5000:5000" volumes: - .:/code

    links: - redis redis: image: redis IPEX Meetup Brno, 9.3.2016 28
  8. 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
  9. 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
  10. Kitematic 4 desktop GUI for Docker 4 Mac and Windows

    only IPEX Meetup Brno, 9.3.2016 31
  11. 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
  12. 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
  13. 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
  14. 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
  15. 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
  16. 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
  17. 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
  18. 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
  19. 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