Kurs om
Docker och Docker Compose

Kurs om hur du använder Docker för applikationsutveckling

I denna kurs får du lära dig allt du behöver veta om Docker för att bygga och driftsätta applikationer i containrar. Du får lära dig om såväl Compose för att assemblera ihop flera images till ett kluster av containrar, som Dockerfile för att designa egna applikations images.

{{ name }}

Snabbfakta

Namn
Docker och Docker Compose
Längd
2 dagar
Nivå
Beginner
Målgrupp
Programutvecklare
Förkunskaper
Erfarenhet av programmering i något språk
Programvara & Verktyg
  • Docker CLI
  • Docker Desktop
  • WSL2 @ Windows 10/11 || Mac || Linux
  • MS Visual Code || JetBrains IDE || any decent text editor
  • Chrome || Edge || Firefox
  • JetBrains DataGrip || HeidiSQL || any db client
  • Google Cloud (GCP) account
  • GCP CLI (gcloud)

Detta får du lära dig på kursen

Här är ett sammandrag i punktform av vad du får lära dig på kursen. Eftersom kursmaterialet är författat på engelska, så återger vi sammandraget också på engelska.

  • Create containers using existing docker images for your application
  • Create container clusters using docker compose
  • Create your own docker images using Dockerfile and docker build
  • Combine Compose with Dockerfile
  • Configure web servers and database servers
  • Utilize docker networks
  • Create an Ubuntu image from scratch

Kursdatum

Här ser du vilka kursdatum som är tillgängliga. Klicka på en av datumknapparna för att anmäla dig till ett kurstillfälle. På kursen pratar läraren svenska, medan vårt kursmaterial alltid är författat på engelska.

Missa inte vår samfaktureringsrabatt! Är ni fler personer från samma företag/organisation som går på samma kurs, rabatteras tillkommande personer med 25%. Ni anmäler er till kursen en och en, men uppger samma företag, så ordnar vi resten. Samtliga deltagare från samma företag ingår på samma faktura, den första till fullt pris och resterande till rabatterat pris.

Klassrum

Du sitter bekvämt i ett av våra klassrum, vilka finns centralt placerade i Stockholms innerstad.

I priset ingår tryckt kursmaterial (och som PDF), samt kaffe/te med smörgås på förmiddagen och kaffe/te med bulle på eftermiddagen.

Pris: 14 000 kr + moms

Fjärrkurs

Du sitter bekvämt framför datorn och deltar i kursen via internet. Vi använder programvaran Zoom för alla våra fjärrkurser.

I priset ingår kursmaterial som PDF.

Pris: 10 000 kr + moms

Företagsinternt

Om ni är tre eller fler personer från samma företag eller organisation, kan ni beställa en företagsanpassad kurs. Då håller vi kursen på ett datum som passar er. Antingen på plats i era lokaler eller som en fjärrkurs. Vi kan också hålla den muntliga framställningen på engelska.

Klicka på knappen nedan för att be om en offert.

Företagsanpassad Kurs

Kursinnehåll

Eftersom kursmaterialet är författat på engelska, så återger vi innehållet också på engelska.

Background / Overview

  • History
  • What is a (Docker) container?
  • Containers vs. Virtual machines
  • Fundamental concepts
  • Docker Hub
  • What is behind Docker?
  • How does Docker run on Windows?

Section: Using Docker

In this section we will use the docker CLI to pull and launch various ready-made docker applications.

Installation

  • Docker Desktop
  • System requirements Windows computers
  • System requirements Mac computers
  • System requirements Linux computers
  • Installation of Docker Engine
  • Extensions

Brief about Linux

  • Linux distributions
  • Distribution versions and their names
  • Debian vs. Ubuntu vs. Alpine
  • Installing program packages in Linux
  • Essential Linux commands

Basic Docker Commands

  • Using the Docker CLI - docker
  • Getting help information
  • Download an image - docker pull
  • Pull from a different registry
  • List images
  • Remove an image
  • Create/launch a container
  • List containers
  • How step into a container
  • Copy files to/from a container
  • Remove containers
  • How container names are created
  • Stopping/starting containers
  • Obtain run-time information
  • Port mapping

Docker Volumes

  • Persisting data
  • Volume types
  • Create a named volume
  • Local development using Docker
  • Example: compile a C++ program without an installed compiler
  • Volume maintenance actions
  • Finding the volume file in the host file system

Configuration

  • How to configure a server?
  • How to pass environment variable values
  • How to connect to a database
  • Sample usage of an MySQL database

Section: Docker Cluster

In this section we will run more than one container and let them interact with each other. You will learn about docker networks and docker compose.

Brief Network Theory

  • How do a computer communicate with another computer
  • What is an IP number
  • What is a port number
  • What is a hostname
  • What is a network
  • What is DNS
  • What is IPv6
  • How to use ifconfig
  • What is a loopback address
  • What is a private IP
  • What is a subnet
  • What is CIDR
  • Special CIDR addresses
  • Address allocation
  • Route table
  • What is a firewall
  • What is NAT / IP masquerading

Docker Network

  • What is a Docker network
  • Network types
  • Default networks
  • Meta-data about a network
  • Create a Docker network
  • Associate a container with a network
  • How to containers might interact

Docker Compose

  • What is docker compose and its purpose
  • Background
  • What is YaML
  • Elements of a compose script
  • Creating a compose script
  • Creating and running a compose service
  • Commonly used compose actions
  • Introspective compose actions
  • Command-line options
  • Dealing with configuration data
  • Setting a simple WordPress system with a MySQL database
  • Using so-called secrets
  • Service dependency
  • Health checks
  • Restart policy
  • YaML extensions used in compose scripts

Section: Creating Images

In this section we will learn how to create our own image, using a Dockerfile.

Dockerfile

  • What is a Dockerfile
  • Dockerfile syntax
  • The most essential directives of a Dockerfile
  • Create an image - docker build
  • Simplest possible Dockerfile
  • How to build and run it
  • Understanding and settings Docker tags
  • A still simple, but more realistic Dockerfile
  • The Express.js server code
  • Running the system outside Docker
  • The Docker file
  • Build the image
  • Create and run a container with our Express.js app

More Dockerfile Directives

  • Additional ways to feed the build
  • Using a .dockerignore file
  • More Dockerfile directives
  • Two variants of command
  • Change the default shell
  • Different RUN command forms
  • Understanding here-document syntax
  • ENTRYPOINT vs. CMD
  • COPY vs. ADD
  • Environment variables (ENV)
  • Configuration variables (ARG)
  • How to create user and group on Debian/Ubuntu/Alpine
  • Change the owner of files
  • Tell Docker which user to run as

Multi-Stage Dockerfile

  • Let's start with a simple Java application
  • Sample build & run
  • What is the container size?
  • Understand build-time vs. run-time
  • Setting up a multi-staged build
  • Improved Dockerfile, with separation of build from runtime
  • Much better image size

Dockerfile - Best Practices

  • Why best practices
  • Use official images
  • Use version tag
  • Pick a small/lean image
  • Reorder to improve layer caching
  • Reduce the layer count
  • Remove stuff not needed any longer
  • Use .dockerignore
  • Use multi-staged build
  • Create dedicated user
  • Spell out options
  • Utilize parallel stages

Image from Scratch

  • How do we create a base/parent image
  • Using FROM scratch
  • Let's build an all-inclusive C++ application
  • Sample build & run
  • How to create Ubuntu image from scratch
  • Usage of debootstrap
  • Usage of docker import
  • Using our own parent image

Section: Applications

Compose with Dockerfile

  • Compose script with build directives
  • Syntax for the build directive
  • Recommendation
  • Building compose images

Node.js: Express.js / TypeScript / Vite.js Application

  • Walkthrough of the source code

Java: Spring-Boot / MySQL Application

  • Walkthrough of the source code

C++: REST-WS Application

  • Walkthrough of the source code

Section: Publishing Images

In this section we discuss various ways of make your image available for others to use.

Registries & Repositories

  • What is a registry and a repository
  • Different forms
  • Importance of tagging
  • Generic step to publish and image

Docker Hub Registry

  • Using Docker Hub
  • Publish to Docker Hub
  • Pulling from your own corner of Docker HUb

Private Registry

  • What is a private registry
  • Installation of a private/local registry
  • Publishing to a local registry
  • Pulling from a local registry

Google Cloud (GCP) Registry

  • What is GCP
  • How Google supports containers
  • Publishing to a GCP registry
  • Pulling from a GCP registry