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

Thinking in Environments with Docker

Thinking in Environments with Docker

Updated and abridged version of my talk "Supercharging development with Docker" for Google Cloud Study Jam 2025 at National Incubation Center, Lahore. This version is focused more on thinking about environments and isolating tasks and their requirements.

https://shyr.io/t/thinking-with-docker

Sheharyar Naseer

January 16, 2025
Tweet

More Decks by Sheharyar Naseer

Other Decks in Technology

Transcript

  1. Background • Indie Nomad Software Architect • 14+ years of

    polyglot experience, focus on Web & Cloud • Worked with Apple, Superlist, AllocatorOne, TheScore, Slab, etc. • StackOverflow: 75,000+ score (Top 5 in Pakistan) • Author / Contributor of multiple famous libraries & tools • Featured on popular developer communities
  2. Scaling Systems • Processes need to mature with the Software

    • More complexity requires more moving parts • Different aspects: • Automating Processes • Expanding Infrastructure • Improving Development
  3. Automating Processes • Tasks increase and grow complex • Reduce

    manual intervention • Automate common steps • PeopleOps, DevOps, SecOps, DataOps, MLOps • Consistency
  4. Expanding Infrastructure • Track and manage growing infra • Increase

    performance • Add more components or features • Configure more tooling & hardware • Keep systems secure & working • Consistent and reliable behaviour
  5. Improving Development • Onboarding developers faster • Consistent development environments

    • Multiple devs working on the same codebase • "But works on my machine!" • Reproducible issues • Focus on development
  6. Packaging Environments • Think about "environment" of your system •

    Reduce to bare essentials • Combine together & isolate from the rest • Two approaches: • Virtual Machines (VMs) • Containers
  7. Technology Verticals • Web & Mobile • ML / AI

    • Distributed Systems • Internet of Things • Mixed Reality • Cloud
  8. Containerization • Modern, cloud-native architecture • Smaller, portable and faster

    • Efficient and light-weight • Tools: • Docker • Podman
  9. Host Operating System Hypervisor Guest OS Guest OS Guest OS

    App App App Runtime Runtime Runtime Host Operating System Container Engine Runtime Runtime App App App vs Virtualization Containerization
  10. Docker is the top-used tool amongst all Professional developers “

     StackOverflow Developer Survey 2023  2019 2020 2021 2022 69% 49% 39% 35%
  11. Docker – The What • "An open-source platform for containerizing

    applications and environments" • Docker Image: • Set of commands describing how to run your app • Docker Container: • Your commands executed • Can run anywhere
  12. 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
  13. Docker – The Why • Ship code faster • Standardize

    operations • Save money • Simplify security • Run and deploy anywhere
  14. Docker – The How • Install Docker • Create a

    "Dockerfile" • Write steps to run app • Run it!
  15. Example – Python App FROM python:3 # Set the app

    directory WORKDIR /app COPY . . # Install dependencies RUN pip3 install -r requirements.txt # Start app EXPOSE 5000 CMD ["python3", "-m", "flask", "run", "--host=0.0.0.0"]
  16. Example – Flutter App FROM fischerscode/flutter:3.22 # Set the development

    directory WORKDIR /dev COPY . . # Install dependencies RUN flutter pub get # Start app CMD ["flutter", "run"]
  17. CloudUp.dev • Dockerfile Generator • Maintained by GDG Lahore •

    Supports common languages • Guided steps https://cloudup.dev/
  18. Build and Run # Build the image docker build -t

    my-app:v1 . # Run the app docker run -it -p 5000:5000 my-app:v1 # Run for different envs docker run -it my-app:v1 --env-file stage.env docker run -it my-app:v1 --env-file prod.env
  19. Infrastructure Providers • Google Cloud Platform • Amazon Web Services

    • Heroku • DigitalOcean • Fly.io • and many more...
  20. Save to Google Cloud # Setup gcloud login gcloud config

    project set ${PROJECT_ID} # Build and Save Image gcloud builds submit \ --tag=gcr.io/${PROJECT_ID}/my-app:v1 .
  21. Helpful Resources KEEP LEARNING Docker • Official Docs: docs.docker.com •

    Friendly Guides: vsupalov.com/docker • Dockerfile Generator: cloudup.dev Google Cloud • GCP Container Registry: gcr.io
  22. Questions?  @  shyr.io [email protected] @sheharyarn These Slides →

    shyr.io/t/thinking-with-docker Original Slides → shyr.io/t/dev-with-docker More Talks → shyr.io/talks