Docker
Docker v.s. Virtual Machines
What is Docker
- Virtualization Software
- Makes developing and deploying applications much easier
- Packages application with all the cecessary dependencies, configuration, system tools and runtime
Docker images is smaller than the VM images
VM is has to boot up a kernel very time,so faster
run VM is compatible with all OS, but Docker can’t (solved it with a Hypervisor layer)
Docker Images v.s. Docker Containers
Images
- Application
- Any services needed
- OS layer
- it is a immutable template that defines how a container will be realized
Container
- actually starts the application
- a running instance of an image
Docker Registries
- a storage and distribution systems for Docker images
- Docker Hub (find and share images)
Docker容器化
把一个应用的以及相关依赖文件全部打包在一个容器里,借助相应平台去运行这个容器里的应用。
Port binding
- publish container port to host
- e.g.
docker run -d -p 9000:80 nginx:1.23
expose port 9000 to nginx port 80 - tend to use the same port as the container
everytime you write run, it starts a new container
Public and Private Docker Registries
Registry v.s. Repository
Registry
- A service providing storage
- collection of repositories
Repository
- Collection of related images with same name but different versions
- 一个应用的不同版本
Dockerfile
- custom images
- a text document that contains commands to assemble an image
- .js file
- start from the base image
Source: https://www.youtube.com/watch?v=pg19Z8LL06w&t=1973s