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 Slide

  2. Michael Lancaster
    @weblancaster

    View Slide

  3. Docker who?!

    View Slide

  4. View Slide

  5. View Slide

  6. What is Docker?

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  10. Why Docker?

    View Slide

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

    View Slide

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

    View Slide

  13. View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  17. 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 Slide

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

    View Slide

  19. $ 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 Slide

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

    View Slide

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

    View Slide

  22. Deployment
    Strategies

    View Slide

  23. View Slide

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

    View Slide