docker
- install初次安装; 
- http proxyhttp 代理 
- Get Started详细介绍 images、container、service、stack概念和层次关系,梳理docker基本操作。 
- Docker overview
- Dockerfile referencedockerfile 语法参考。 
- Compose file version 3 referenceservice 描述文件 compose file语法参考。 
- docker ps 命令
- docker container 操作命令https://docs.docker.com/engine/reference/commandline/container/ 
docs
image
| Command | Description | 
|---|---|
| docker image build | Build an image from a Dockerfile | 
| docker image history | Show the history of an image | 
| docker image import | Import the contents from a tarball to create a filesystem image | 
| docker image inspect | Display detailed information on one or more images | 
| docker image load | Load an image from a tar archive or STDIN | 
| docker image ls | List images | 
| docker image prune | Remove unused images | 
| docker image pull | Pull an image or a repository from a registry | 
| docker image push | Push an image or a repository to a registry | 
| docker image rm | Remove one or more images | 
| docker image save | Save one or more images to a tar archive (streamed to STDOUT by default) | 
| docker image tag | Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE | 
container
| Command | Description | 
|---|---|
| docker container attach | Attach local standard input, output, and error streams to a running container | 
| docker container commit | Create a new image from a container’s changes | 
| docker container cp | Copy files/folders between a container and the local filesystem | 
| docker container create | Create a new container | 
| docker container diff | Inspect changes to files or directories on a container’s filesystem | 
| docker container exec | Run a command in a running container | 
| docker container export | Export a container’s filesystem as a tar archive | 
| docker container inspect | Display detailed information on one or more containers | 
| docker container kill | Kill one or more running containers | 
| docker container logs | Fetch the logs of a container | 
| docker container ls | List containers | 
| docker container pause | Pause all processes within one or more containers | 
| docker container port | List port mappings or a specific mapping for the container | 
| docker container prune | Remove all stopped containers | 
| docker container rename | Rename a container | 
| docker container restart | Restart one or more containers | 
| docker container rm | Remove one or more containers | 
| docker container run | Run a command in a new container | 
| docker container start | Start one or more stopped containers | 
| docker container stats | Display a live stream of container(s) resource usage statistics | 
| docker container stop | Stop one or more running containers | 
| docker container top | Display the running processes of a container | 
| docker container unpause | Unpause all processes within one or more containers | 
| docker container update | Update configuration of one or more containers | 
| docker container wait | Block until one or more containers stop, then print their exit codes | 
dirs
有些疑问,先前错误的理解了image和container的关系,以为container是运行时(running time)的image,其实原文描述的意思是可运行的(runable)。然后可运行的container的再区分正在运行和为未运行的。
那么还有一个问题,docker image和container各自在磁盘的哪里?是否可以备份和删除。
graph LR
a[Dockerfile]--docker build-->b[image]--docker create-->c[containner]-- "docker (container) start"-->d[running]
b--docker run-->d# tree -L 2 /var/lib/docker
/var/lib/docker
├── builder
│   └── fscache.db
├── buildkit
│   ├── cache.db
│   ├── content
│   ├── executor
│   ├── metadata.db
│   └── snapshots.db
├── containers          #容器相关配置文件
│   ├── 8e0a0480df05d9ed5f048d8bfe00c7b5735cb22376409126127c3f59407cd629
│   ├── 9892bfd530a1851985b1791c78b0001d420713647cb93cf71a050f1f97c85353
│   └── c64403de18d9435c935b4a9a3fdf2fd3a4ade8da03624e32702c3083186e7efc
├── image
│   └── overlay2       #镜像,不包含镜像文件,看起是配置文件;
├── network
│   └── files
├── overlay2           #容器、镜像、容器运行差异文件;
│   ├── 1f3492ed2c3ed859daa533057e8b05d667f8401f64c7dfb59033b45489a62bf2
│   ├── 2604ee693ddb1e99bfcb3da7b0cc9653dcb0e49c91d6ba0d2efb74cc90a3331a
│   ├── 2604ee693ddb1e99bfcb3da7b0cc9653dcb0e49c91d6ba0d2efb74cc90a3331a-init
│   ├── 60b8db6fd346f67d3ef86008a6d9cda264ae23307b7645724083a4b454ac5428
│   ├── 71c73bf0c06709216a4b2cb897fc2168d97ab0388a2687764f6f8ae5a4ccdab4
│   ├── 8ea40cec5c4646a32e2068847c8ef36a5d938cbd52e68408854b79f2736f9cb7
│   ├── 8ea40cec5c4646a32e2068847c8ef36a5d938cbd52e68408854b79f2736f9cb7-init
│   ├── bf0565d56baeb559a41271e4b6de85111486ff71542d8198b406e04a977e80c4
│   ├── bf0565d56baeb559a41271e4b6de85111486ff71542d8198b406e04a977e80c4-init
│   ├── fc9daf65ce0b47bb9f46d528bda503cfaab55ef0eeda58bc09f52453f3c73215
│   └── l
├── plugins
│   ├── storage
│   └── tmp
├── runtimes
├── swarm
├── tmp
├── trust
└── volumes
    └── metadata.db 
            
        
还不快抢沙发