Skip to content

Latest commit

 

History

History
115 lines (93 loc) · 2.38 KB

24-docker_demo.md

File metadata and controls

115 lines (93 loc) · 2.38 KB
SPDX-FileCopyrightText SPDX-License-Identifier title author footer description keywords color class style
© 2023 Menacit AB <foss@menacit.se>
CC-BY-SA-4.0
Virtualisation course: Docker demo
Joel Rangsmo <joel@menacit.se>
© Course authors (CC BY-SA 4.0)
Demonstration of Docker for virtualised development
virtualisation
docker
container
vm
demo
demonstration
devops
#ffffff
invert
section.center { text-align: center; }

Docker demonstration

The whale that changed everything

bg right:30%


$ sudo docker run -ti ubuntu:18.04 /bin/bash

Unable to find image 'ubuntu:18.04' locally
18.04: Pulling from library/ubuntu
a055bf07b5b0: Pull complete 

root@79424287b988:/#

bg right:30%


FROM python:3.11.0

RUN pip install Flask==2.2.2
COPY app.py .

USER 10000
CMD ["flask", "run", "--host", "0.0.0.0"]

bg right:30%


$ sudo docker build -t kool_app:0.2 .
Sending build context to Docker daemon  4.608kB

Step 1/5 : FROM python:3.11.0
Step 2/5 : RUN pip install Flask==2.2.2
Step 3/5 : COPY app.py .
Step 4/5 : USER 10000
Step 5/5 : CMD ["flask", "run", "--host", "0.0.0.0"]
Successfully tagged kool_app:0.2
$ sudo docker run kool_app:0.2

* Debug mode: off
* Running on all addresses (0.0.0.0)

services:
  db:
    image: database:14
    volumes:
      - ./data/db:/var/lib/database/data
    environment:
      - DB_USER=myapp
      - DB_PASSWORD=G0d!

  web:
    image: my_awesome_app:v9
    ports:
      - "80:8000"
    environment:
      - DB_URL=sql://db
      - DB_USER=myapp
      - DB_PASSWORD=G0d!
    depends_on:
      - db

bg right:30%


Further awesomeness

Tons of pre-built images on Docker hub.

Supports both OS-level and (with some effort) HW-level virtualisation.

Read The Fine Manual!

bg right:30%