Slide 1

Slide 1 text

Docker 101 cyyeh 2019.12.5 1

Slide 2

Slide 2 text

Outline What is Docker and why Docker? Docker engine and Docker architecture Common Docker usage scenarios Use Docker images Create Docker images Publish Docker images 2

Slide 3

Slide 3 text

Imagine the following scenarios which you might have experienced... 1. You have several projects at your local machine where each project's dependencies contradict with each other. ex: project A requires python3.6, but project B requires python3.7 2. You need to have multiple machines set up the same working environment. 3. You want to try some new features, but that requires lots of dependencies to be installed. 3

Slide 4

Slide 4 text

What is Docker? Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. With Docker, you can manage your infrastructure in the same ways you manage your applications. By taking advantage of Docker’s methodologies for shipping, testing, and deploying code quickly, you can significantly reduce the delay between writing code and running it in production. (from Docker documentation) “ “ 4

Slide 5

Slide 5 text

Simply put... 1. You write down everything required to run your application in a document. 2. Docker makes a box that packs your application according to your document, then you can move this box to everywhere you like. 3. Whenever you need to run your application, you only need to open the box again. Docker is a platform that enables you to accomplish above functionalities easily. 5

Slide 6

Slide 6 text

Glossary 1. You write down everything required to run your application in a document(Dockerfile). 2. Docker makes a box(image) that packs your application according to your document, then you can move this box to everywhere(image registry) you like. 3. Whenever you need to run your application, you only need to open the box again.(container) 6

Slide 7

Slide 7 text

Why Docker 1. Docker enables you to run your applications in isolated environments. -> No dependencies conflict anymore 2. You can make sure application environments are the same. (Collaboration is easier too) 3. Container is easily-disposable, you can test your applications quickly without polluting your environment. 7

Slide 8

Slide 8 text

Docker Engine 8

Slide 9

Slide 9 text

Docker Architecture 9

Slide 10

Slide 10 text

Common Docker usage scenarios 1. Use Docker images 2. Create Docker images 3. Publish Docker images 10

Slide 11

Slide 11 text

Use Docker images docker run hello-world docker ps docker ps -a docker logs docker inspect docker stop docker rm docker --help docker run -d -p 8086:80 nextcloud docker run -d -v /your/dir:/data/db mongo 11

Slide 12

Slide 12 text

Create Docker images FROM node:11-alpine ENV diameter=4.0 COPY compute.js . CMD node compute.js docker build -t . docker run --rm docker run --rm -e diameter=5.0 12

Slide 13

Slide 13 text

Publish Docker images docker tag / docker login -u -p docker push / docker run / docker pull / 13

Slide 14

Slide 14 text

Restart mode docker run -d -p 80 --restart unless-stopped nginx Monitoring docker stats Reclaim your disk docker container prune -f docker volume prune -f docker image prune -f Orchestration(managing running containers) Kubernetes or Docker Swarm are tools to help you manage containers 14

Slide 15

Slide 15 text

Reference Docker Documentation 15