Cloud Essentials • Lahore, 2023
Docker
on Google Cloud Platform
Slide 2
Slide 2 text
Technology advisor & consultant for startups,
and Manager at Google Developers Group
Find me anywhere @sheharyarn
Sheharyar Naseer
Slide 3
Slide 3 text
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
Slide 4
Slide 4 text
Outline
Light Intro to Cloud
Docker: What, Why & How
Google Cloud Platform & Docker
Live Demo
Learning Resources
Q&A
Slide 5
Slide 5 text
Cloud Computing
A LIGHT INTRODUCTION
Slide 6
Slide 6 text
Cloud Computing
• On-demand access to computing resources, including
servers, storage and networking infrastructure, hosted at a
remote data-center
• "Someone else's computer"
Slide 7
Slide 7 text
Technology Verticals
• Web & Mobile
• ML / AI
• Distributed Systems
• Internet of Things
• Mixed Reality
Slide 8
Slide 8 text
Technology Verticals
• Web & Mobile
• ML / AI
• Distributed Systems
• Internet of Things
• Mixed Reality
CLOUD
Slide 9
Slide 9 text
Careers in Cloud
• Web Developer (Backend & Frontend)
• Site Reliability Engineer
• Software/Cloud Architect
• Networking Specialist
• Cloud Security Specialist
• MLOps Engineer
• Big Data Engineer
Slide 10
Slide 10 text
Docker
THE WHAT, WHY AND HOW
Slide 11
Slide 11 text
Docker is becoming a
fundamental tool for
Professional Developers
“
StackOverflow Developer Survey 2022 2019 2020 2021 2022
69%
49%
39%
35%
Slide 12
Slide 12 text
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
Slide 13
Slide 13 text
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
Slide 14
Slide 14 text
Docker – The Why
• Ship code faster
• Standardize operations
• Save money
• Simplify security
• Run and deploy anywhere
Slide 15
Slide 15 text
Docker – The How
• Install Docker
• Create a Dockerfile
• Write steps to run app
• Run it!
Slide 16
Slide 16 text
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"]
Slide 17
Slide 17 text
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"]
Slide 18
Slide 18 text
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
Slide 19
Slide 19 text
Live Demo
DOCKER IN ACTION
Slide 20
Slide 20 text
Google Cloud
MADE EASY WITH DOCKER
Slide 21
Slide 21 text
Google Cloud Platform
• IaaS: Infrastructure as a Service
• One of the "Big 3"
• Servers, Storage, Databases, Networking, etc.
• Extremely powerful
Slide 22
Slide 22 text
GCP + Docker
• World-class support for Docker
• Cloud-native tooling
• Build, Deploy and Run any Docker image
• Simple experience
Slide 23
Slide 23 text
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 .
Slide 24
Slide 24 text
Deploy with Cloud Run
• Instantly deploy any container
• Very simple UI
• Deploy previously uploaded