# Develope .NET using Docker
## What is Docker?
### Terminology
- Docker
- Container
- Image
- Container Registry
- Kubernetes
- Virtualization
- scale up/down vs scale out/in
- Windows container
- Microservices vs Monolithic
- Docker Compose
- Docker Swarm vs Kubernetes
- Docker volume
- Docker Network
- Dockerfile
- Multi-stage build
- File System
- file path / vs \
## Why Docker?
## Check Points
- Docker multi-stage build feature
- dotnet/sdk
- dotnet/aspnet
## Issues ?
- Docker in Production Environment
- How to build smaller image ?
- Docker Security ?
- Docker Desktop for linux ?
https://docs.docker.com/desktop/faqs/linuxfaqs/#why-does-docker-desktop-for-linux-run-a-vm
- Docker Hareware requirement ?
- memory? disk? cpu? network?
### Docker CLI Cheat Sheat
#### Image
Build an image
`docker build -t <image name> <folder has Dockerfile>`
`docker build -t <image name> -f <docker file>`
#### Container
List all running container
`docker container ls`
List all containers (even if it's not running)
`docker container ls --all(-a)`
`docker exec -it <container name> bash`
-- old version
#### Build
Build an image from the Dockerfile in the current directory and tag the image
`docker build -t <image>`
List all iamges that are locally stored with the Docker Engine
`docker image ls`
Delete image from the local image store
`docker image rm <image>`
#### Share
Pull an image from a registry
`docker pull <image>`
Retag a local image with a new image name and tag
`docker tag <image> <repo/iamge>`
Push an image to a registry
`docker push <repo/image>`
#### Run
Run a container
`docker container run --name web -p 5000:80 alpine:3.9`
Stop a running container through SIGTERM
`docker container stop web`
Stop a running container through SIGKILL
`docker container kill web`
List the networks
`docker network ls`
List the running containers(add --all to include stopped container)
`docker container ls`
Delete all running and stopped containers
`docker container rm -f $(docker ps -aq)`
Print the last 100 lines of a container's logs
`docker container logs --tail 100 web`
### 需要搞懂弄熟的東西
#### 與 Docker 無關
`dotnet` cli 的使用
1. restore
- nuget source (private/public)
- platform
3. build
- sdk version
- platform
5. publish
- 最佳化程度
- self-contained