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

Docker?! But I'm a frontend.

Docker?! But I'm a frontend.

Shipping and developing applications in different environments are hard and we became masters of workarounds. Docker makes our lives easier by shipping and running consistently the same container in every environment.

Michael Lancaster

September 25, 2017
Tweet

More Decks by Michael Lancaster

Other Decks in Technology

Transcript

  1. Docker? but I’m a developer
    Photo by Axel Ahoi on Unsplash

    View full-size slide

  2. Michael Lancaster
    @weblancaster

    View full-size slide

  3. Docker who?!

    View full-size slide

  4. What is Docker?

    View full-size slide

  5. Hypervisor
    Hardware
    App A
    Bins/Libs
    Guest OS
    App B
    Bins/Libs
    Guest OS
    App C
    Bins/Libs
    Guest OS
    VM
    Virtual Machines

    View full-size slide

  6. Docker
    Host OS
    Hardware
    Bins/Libs Bins/Libs Bins/Libs
    Redis Nginx Python
    Containers
    Container

    View full-size slide

  7. Container
    (writable, running application)
    Layered image 2
    (read-only)
    Layered image 1
    (read-only)
    Platform image
    (runtime environment, read-only)
    Image layers

    View full-size slide

  8. Cost savings
    Productivity increase
    Consistency across environments
    Lightweight
    Security
    Isolation

    View full-size slide

  9. How to
    Install
    https://docs.docker.com/engine/installation/#supported-platforms

    View full-size slide

  10. Using
    CLI
    https://docs.docker.com/engine/reference/builder

    View full-size slide

  11. $ docker run -p 8080:80 --name static -d nginx
    CLI:

    View full-size slide

  12. Using
    Dockerfile
    https://docs.docker.com/engine/reference/builder

    View full-size slide

  13. Dockerfile:
    FROM nginx
    COPY build /usr/share/nginx/html
    $ docker build -t static-web .
    $ docker run -p 8080:80 --name static -d static-web
    Build image:
    Run container:

    View full-size slide

  14. Using
    Docker-compose
    https://docs.docker.com/compose/compose-file

    View full-size slide

  15. $ docker-compose -f docker-compose.yml up -d
    CLI:
    version: “3”
    services:
    static:
    container_name: frontinbh_static
    build: .
    ports:
    - "8080:80"
    server:
    image: mhart/alpine-node:latest
    working_dir: /usr/src/app
    container_name: frontinbh_server
    volumes:
    - ./server:/usr/src/app
    ports:
    - "3000:3000"
    command: npm start
    docker-compose.yml:

    View full-size slide

  16. Releasing
    the image
    https://docs.docker.com/docker-cloud/builds/push-images/

    View full-size slide

  17. Tag image:
    $ docker tag frontinbh_static weblancaster/frontinbh_static
    $ docker login
    $ docker push weblancaster/frontinbh_static
    Registry login (Dockerhub default):
    Push image:

    View full-size slide

  18. Deployment
    Strategies

    View full-size slide

  19. Thanks!
    https://github.com/weblancaster/frontinbh-docker-talk

    View full-size slide