A Hands-on Intro to
Containers
Gene Gotimer
Principal DevOps Engineer at Praeses, LLC
@OtherDevOpsGene
What are containers?
@OtherDevOpsGene #NebraskaCode2024 2
Virtualization
• One physical system simulating multiple virtual systems
• Shared:
• CPU
• Memory
• Networking
• Hard drive
• Peripherals
@OtherDevOpsGene #NebraskaCode2024 3
Containerization
Containers are not miniature VMs They are apps that run on the host
@OtherDevOpsGene #NebraskaCode2024 4
Where should we use
containers?
@OtherDevOpsGene #NebraskaCode2024 5
Pipeline infrastructure
• Jenkins
• Slaves are fresh Docker images created as needed
• Always a clean build environment
• Easy to parallelize
• Jenkins X
• “opinionated way to do continuous delivery with Kubernetes”
@OtherDevOpsGene #NebraskaCode2024 6
Testing
• Selenium Grid nodes
• Easy to spin up nodes with different versions of different browsers
• Makes parallel testing easy
@OtherDevOpsGene #NebraskaCode2024 7
Deployments
• Always a fresh system
• No garbage built up from prior deploys
• Everyone can have their own
• Create and recreate on demand
@OtherDevOpsGene #NebraskaCode2024 8
Immutable
• Installed and configured
• Just use as is
• Deploy only once
• No installation or configuration to do
• Can be passed through the SDLC as a single piece
• Never changes, so what was tested is exactly what was deployed
• No more “works on my machine”
@OtherDevOpsGene #NebraskaCode2024 9
Scalability
• Immutable, so they can easily be cloned
• Elasticity- spin up and shut down instances as needed
@OtherDevOpsGene #NebraskaCode2024 10
Experimentation
• Experiment with
• New tools
• New versions
• New techniques
• New configurations
@OtherDevOpsGene #NebraskaCode2024 11
Docker basics
@OtherDevOpsGene #NebraskaCode2024 12
Docker
• Containerization software
• Free, open-source
• Runs on Windows, Mac, Linux
• Easy to install
• Works well in AWS, Azure, Google
@OtherDevOpsGene #NebraskaCode2024 13
Layers
Containers are layers of filesystems
Files overlap, but do not replace
14
RUN set -xe && echo '#&/bin/sh' > … 811B
ADD file:435d9776fdd3a183… 72.9MB
RUN [ -z "$(apt-get indextargets)" ]… 0B
RUN mkdir -p /run/systemd && echo ‘d… 7B
CMD ["/bin/bash"] 0B
instance data container layer
(read-write)
immutable
image
layers
(read-only)
ubuntu:20.04 container
@OtherDevOpsGene #NebraskaCode2024
Image and container
• Image – software bundle that will run on Docker
• Container – running (or stopped) instance of an image
• read-write layer overlaid
images
containers
@OtherDevOpsGene #NebraskaCode2024 15
Registry
• Registry – cloud repository of Docker images
• public or hosted
• Docker Hub – public hosted registry - https:&&hub.docker.com/
• Some Cloud alternatives:
• Google GCR - https:&&cloud.google.com/container-registry/
• Amazon ECR - https:&&aws.amazon.com/ecr/
• Quay - https:&&quay.io/
• Some on-premises alternatives:
• Sonatype Nexus - https:&&w&&.sonatype.com/
• JFrog Artifactory - https:&&jfrog.com/
@OtherDevOpsGene #NebraskaCode2024 16
Kubernetes (k8s)
• Open-source container orchestration framework
• service discovery
• load balancing
• storage orchestration
• automated rollouts and rollbacks
• self-healing
• secret management
• horizontal scaling
@OtherDevOpsGene #NebraskaCode2024 17
GitHub repo
https:&&github.com/OtherDevOpsGene/intro-to-docker
@OtherDevOpsGene #NebraskaCode2024 19
Questions?
Gene Gotimer
Principal DevOps Engineer at Praeses, LLC
@OtherDevOpsGene

A Hands-on Intro to Containers- Nebraska.Code()

  • 1.
    A Hands-on Introto Containers Gene Gotimer Principal DevOps Engineer at Praeses, LLC @OtherDevOpsGene
  • 2.
  • 3.
    Virtualization • One physicalsystem simulating multiple virtual systems • Shared: • CPU • Memory • Networking • Hard drive • Peripherals @OtherDevOpsGene #NebraskaCode2024 3
  • 4.
    Containerization Containers are notminiature VMs They are apps that run on the host @OtherDevOpsGene #NebraskaCode2024 4
  • 5.
    Where should weuse containers? @OtherDevOpsGene #NebraskaCode2024 5
  • 6.
    Pipeline infrastructure • Jenkins •Slaves are fresh Docker images created as needed • Always a clean build environment • Easy to parallelize • Jenkins X • “opinionated way to do continuous delivery with Kubernetes” @OtherDevOpsGene #NebraskaCode2024 6
  • 7.
    Testing • Selenium Gridnodes • Easy to spin up nodes with different versions of different browsers • Makes parallel testing easy @OtherDevOpsGene #NebraskaCode2024 7
  • 8.
    Deployments • Always afresh system • No garbage built up from prior deploys • Everyone can have their own • Create and recreate on demand @OtherDevOpsGene #NebraskaCode2024 8
  • 9.
    Immutable • Installed andconfigured • Just use as is • Deploy only once • No installation or configuration to do • Can be passed through the SDLC as a single piece • Never changes, so what was tested is exactly what was deployed • No more “works on my machine” @OtherDevOpsGene #NebraskaCode2024 9
  • 10.
    Scalability • Immutable, sothey can easily be cloned • Elasticity- spin up and shut down instances as needed @OtherDevOpsGene #NebraskaCode2024 10
  • 11.
    Experimentation • Experiment with •New tools • New versions • New techniques • New configurations @OtherDevOpsGene #NebraskaCode2024 11
  • 12.
  • 13.
    Docker • Containerization software •Free, open-source • Runs on Windows, Mac, Linux • Easy to install • Works well in AWS, Azure, Google @OtherDevOpsGene #NebraskaCode2024 13
  • 14.
    Layers Containers are layersof filesystems Files overlap, but do not replace 14 RUN set -xe && echo '#&/bin/sh' > … 811B ADD file:435d9776fdd3a183… 72.9MB RUN [ -z "$(apt-get indextargets)" ]… 0B RUN mkdir -p /run/systemd && echo ‘d… 7B CMD ["/bin/bash"] 0B instance data container layer (read-write) immutable image layers (read-only) ubuntu:20.04 container @OtherDevOpsGene #NebraskaCode2024
  • 15.
    Image and container •Image – software bundle that will run on Docker • Container – running (or stopped) instance of an image • read-write layer overlaid images containers @OtherDevOpsGene #NebraskaCode2024 15
  • 16.
    Registry • Registry –cloud repository of Docker images • public or hosted • Docker Hub – public hosted registry - https:&&hub.docker.com/ • Some Cloud alternatives: • Google GCR - https:&&cloud.google.com/container-registry/ • Amazon ECR - https:&&aws.amazon.com/ecr/ • Quay - https:&&quay.io/ • Some on-premises alternatives: • Sonatype Nexus - https:&&w&&.sonatype.com/ • JFrog Artifactory - https:&&jfrog.com/ @OtherDevOpsGene #NebraskaCode2024 16
  • 17.
    Kubernetes (k8s) • Open-sourcecontainer orchestration framework • service discovery • load balancing • storage orchestration • automated rollouts and rollbacks • self-healing • secret management • horizontal scaling @OtherDevOpsGene #NebraskaCode2024 17
  • 18.
  • 19.
    Questions? Gene Gotimer Principal DevOpsEngineer at Praeses, LLC @OtherDevOpsGene