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 Slide

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

    View 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 Slide

  4. Outline
    Light Intro to Cloud


    Docker: What, Why & How


    Google Cloud Platform & Docker


    Live Demo


    Learning Resources


    Q&A

    View Slide

  5. Cloud Computing
    A LIGHT INTRODUCTION

    View 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 Slide

  7. Technology Verticals
    • Web & Mobile


    • ML / AI


    • Distributed Systems


    • Internet of Things


    • Mixed Reality

    View Slide

  8. Technology Verticals
    • Web & Mobile


    • ML / AI


    • Distributed Systems


    • Internet of Things


    • Mixed Reality
    CLOUD

    View 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 Slide

  10. Docker
    THE WHAT, WHY AND HOW

    View Slide

  11. Docker is becoming a
    fundamental tool for
    Professional Developers


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

    View 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 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 Slide

  14. Docker – The Why
    • Ship code faster


    • Standardize operations


    • Save money


    • Simplify security


    • Run and deploy anywhere

    View Slide

  15. Docker – The How
    • Install Docker


    • Create a Dockerfile


    • Write steps to run app


    • Run it!

    View 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 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 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 Slide

  19. Live Demo
    DOCKER IN ACTION

    View Slide

  20. Google Cloud
    MADE EASY WITH DOCKER

    View Slide

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


    • One of the "Big 3"


    • Servers, Storage, Databases, Networking, etc.


    • Extremely powerful

    View Slide

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


    • Cloud-native tooling


    • Build, Deploy and Run any Docker image


    • Simple experience

    View 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 Slide

  24. Deploy with Cloud Run
    • Instantly deploy any container


    • Very simple UI


    • Deploy previously uploaded

    View Slide

  25. Live Demo
    GCP CLOUD RUN WITH DOCKER

    View 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 Slide

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


    More Talks → shyr.io/talks
    🌎


    @



    shyr.io


    [email protected]


    @sheharyarn

    View Slide