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

Docker on Google Cloud

Docker on Google Cloud

I gave this talk on using Docker with Google Cloud at the "Cloud Essentials" developer event, targeted towards beginners and junior software developers.

The Cloud Essentials event was hosted at FAST-NUCES in Lahore by GDSC and GDG.

Talk Video and more details at: https://shyr.io/t/docker-gcp

Sheharyar Naseer

March 06, 2023
Tweet

More Decks by Sheharyar Naseer

Other Decks in Technology

Transcript

  1. Cloud Essentials • Lahore, 2023
    Docker


    on Google Cloud Platform

    View full-size slide

  2. Technology advisor & consultant for startups,
    and Manager at Google Developers Group
    Find me anywhere @sheharyarn
    Sheharyar Naseer

    View full-size slide

  3. Background
    • Indie Nomad Software Architect


    • 12+ years of polyglot experience, focus on Web & Cloud


    • StackOverflow: 70,000+ score (Top 5 in Pakistan)


    • Author / Contributor of multiple famous libraries & tools


    • Featured on popular developer communities

    View full-size slide

  4. Outline
    Light Intro to Cloud


    Docker: What, Why & How


    Google Cloud Platform & Docker


    Live Demo


    Learning Resources


    Q&A

    View full-size slide

  5. Cloud Computing
    A LIGHT INTRODUCTION

    View full-size slide

  6. Cloud Computing
    • On-demand access to computing resources, including
    servers, storage and networking infrastructure, hosted at a
    remote data-center


    • "Someone else's computer"

    View full-size slide

  7. Technology Verticals
    • Web & Mobile


    • ML / AI


    • Distributed Systems


    • Internet of Things


    • Mixed Reality

    View full-size slide

  8. Technology Verticals
    • Web & Mobile


    • ML / AI


    • Distributed Systems


    • Internet of Things


    • Mixed Reality
    CLOUD

    View full-size slide

  9. Careers in Cloud
    • Web Developer (Backend & Frontend)


    • Site Reliability Engineer


    • Software/Cloud Architect


    • Networking Specialist


    • Cloud Security Specialist


    • MLOps Engineer


    • Big Data Engineer

    View full-size slide

  10. Docker
    THE WHAT, WHY AND HOW

    View full-size slide

  11. Docker is becoming a
    fundamental tool for
    Professional Developers


    StackOverflow Developer Survey 2022  2019 2020 2021 2022
    69%
    49%
    39%
    35%

    View full-size slide

  12. Docker – The What
    • "An open-source platform for containerizing
    applications and environments"


    • Docker Image:


    • Set of commands describing how to run your app


    • Write once, run anywhere


    • The "ABCs" of your Cloud journey

    View full-size slide

  13. Docker – The Why
    • Imagine buying a new computer


    • You set it up and install apps


    • Run system updates, etc.


    • Software:


    • Repeat steps on every fresh deploy


    • Manually run updates


    • Fix broken steps

    View full-size slide

  14. Docker – The Why
    • Ship code faster


    • Standardize operations


    • Save money


    • Simplify security


    • Run and deploy anywhere

    View full-size slide

  15. Docker – The How
    • Install Docker


    • Create a Dockerfile


    • Write steps to run app


    • Run it!

    View full-size slide

  16. Example – Java App
    FROM openjdk:8-jdk-alpine

    # Copy code

    WORKDIR /app

    COPY . .

    # Compile app

    RUN ./gradlew build

    RUN mv ./build/libs
    / *
    .jar ./app.jar

    # Start app

    CMD ["java", "-jar", "/app/app.jar"]

    View full-size slide

  17. Example – React App
    FROM node:16-alpine

    # Copy code

    WORKDIR /app

    COPY . .

    # Build app

    RUN npm ci

    RUN npm run build

    # Start the app

    CMD ["npx", "serve", "build"]

    View full-size slide

  18. Build and Run
    # Run Java App

    docker build -t demo-java:v1 .

    docker run -it -p 8080:8080 demo-java:v1

    # Run React app

    docker build -t demo-react:v1 .

    docker run -it -p 3000:3000 demo-react:v1

    View full-size slide

  19. Live Demo
    DOCKER IN ACTION

    View full-size slide

  20. Google Cloud
    MADE EASY WITH DOCKER

    View full-size slide

  21. Google Cloud Platform
    • IaaS: Infrastructure as a Service


    • One of the "Big 3"


    • Servers, Storage, Databases, Networking, etc.


    • Extremely powerful

    View full-size slide

  22. GCP + Docker
    • World-class support for Docker


    • Cloud-native tooling


    • Build, Deploy and Run any Docker image


    • Simple experience

    View full-size slide

  23. Save Images to Cloud Registry
    # Setup

    gcloud login

    gcloud config project set ${PROJECT_ID}

    # Build and Save Image

    gcloud builds submit \

    - -
    tag=gcr.io/${PROJECT_ID}/demo-react:v1 .

    View full-size slide

  24. Deploy with Cloud Run
    • Instantly deploy any container


    • Very simple UI


    • Deploy previously uploaded

    View full-size slide

  25. Live Demo
    GCP CLOUD RUN WITH DOCKER

    View full-size slide

  26. Helpful Resources
    KEEP LEARNING
    Docker


    • Official Docs: docs.docker.com


    • Friendly Guides: vsupalov.com/docker/


    • Dockerfile Generator: cloudup.dev
    Google Cloud


    • Container Registry: cloud.google.com/container-registry/


    • Cloud Run: cloud.google.com/run/docs/

    View full-size slide

  27. Questions?
    These Slides → shyr.io/t/docker-gcp


    More Talks → shyr.io/talks
    🌎


    @



    shyr.io


    [email protected]


    @sheharyarn

    View full-size slide