Skip to content

Docker & Kubernetes Overview

Video Recording

Docker & Kubernetes Overview - OneDrive Recording

Note: Connect your OneDrive account to access the recording.

Summary

Summary generated by AI from video transcript.

Docker

Running a Docker Image

  • By default, docker run executes the image's default command, which often does nothing and exits immediately
  • To keep a container running, you need to provide a command that runs indefinitely, such as tail -f /dev/null
  • Example: docker run -it ubuntu /bin/bash

Interacting with a Running Container

  • docker exec allows you to execute commands within a running container
  • Example: docker exec -it <container_name> /bin/bash

Docker Images and Tags

  • Images are stored in repositories, with Docker Hub being the default
  • Tags are used to specify versions of an image, similar to Git tags
  • Example: docker run ubuntu:25

Docker Compose

  • Docker Compose is used to define and manage multi-container applications
  • It uses a YAML file (docker-compose.yml) to specify the services, networks, and volumes for the application

Dockerfiles

Dockerfiles are used to build Docker images. They consist of a series of instructions that define the image's contents and configuration.

Example:

FROM ubuntu:24
RUN apt update && apt install -y apache2

Volumes

  • Volumes are used to persist data outside of the container's lifecycle
  • They can be mounted to specific directories within the container

Context

  • The context is the base directory used for building the image
  • It is specified in the docker-compose.yml file or as an argument to the docker build command

Kubernetes

Declarative Model

Kubernetes operates on a declarative model, where you define the desired state of the system, and Kubernetes figures out how to achieve it.

Pods

  • Pods are the smallest deployable unit in Kubernetes
  • They typically contain one or more containers

Deployments

Deployments are used to manage the rollout and scaling of pods.

Namespaces

Namespaces are used to divide a Kubernetes cluster into logical partitions.

YAML Files

Kubernetes configurations are defined in YAML files.

Example:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-app
spec:
  replicas: 3
  selector:
    matchLabels:
      app: my-app
  template:
    metadata:
      labels:
        app: my-app
    spec:
      containers:
      - name: my-app
        image: my-app:latest

Performance

  • Kubernetes introduces some overhead due to virtualization
  • However, it is still widely used in production due to its scalability and other benefits
Last modified by: Unknown