CIS 527



Lab 5.A - Docker

Image Source: Wikipedia

Terminology

  • Image: read-only template to build a container. May be based on another image
  • Container: a runnable instance of an image
  • Volume: a persistent storage location outside a container

Docker Components

  • Docker Engine
    • Docker Daemon
    • Docker Client
  • Docker Desktop
  • Docker Compose
  • Registry

Docker Commands

  • pull - Download an Image
  • images - List images
  • run - Create a Container
  • start | stop - Start/Stop Container
  • ps - List Running Containers
  • exec - Run Command in Container
  • logs - View Container Logs

Docker Images

  • Docker Hub
  • Other Repositories
  • Tags
  • Alpine vs. Others
  • Official vs. Community

Show Docker Hub

  • Official Images
  • Hello World
  • Nginx

Commands

  • docker pull hello-world
  • docker run hello-world
  • docker run --name nginx -d nginx:alpine
  • docker ps
  • docker exec -it nginx /bin/sh
  • curl localhost:80
  • docker stop nginx
  • docker container prune

Open Questions

  • How to access outside Docker?
  • How to host own files in Nginx?
  • How to persist data from Containers?
  • How to simplify Docker commands?