背景说明
解决方案
帮助命令
[root@template ~]# docker helpUsage: docker [OPTIONS] COMMANDA self-sufficient runtime for containersOptions:--config string Location of client config files (default "/root/.docker")-c, --context string Name of the context to use to connect to the daemon (overrides DOCKER_HOST env var and default context set with "docker context use")-D, --debug Enable debug mode-H, --host list Daemon socket(s) to connect to-l, --log-level string Set the logging level ("debug"|"info"|"warn"|"error"|"fatal") (default "info")--tls Use TLS; implied by --tlsverify--tlscacert string Trust certs signed only by this CA (default "/root/.docker/ca.pem")--tlscert string Path to TLS certificate file (default "/root/.docker/cert.pem")--tlskey string Path to TLS key file (default "/root/.docker/key.pem")--tlsverify Use TLS and verify the remote-v, --version Print version information and quitManagement Commands:app* Docker App (Docker Inc., v0.9.1-beta3)builder Manage buildsbuildx* Docker Buildx (Docker Inc., v0.8.1-docker)config Manage Docker configscontainer Manage containerscontext Manage contextsimage Manage imagesmanifest Manage Docker image manifests and manifest listsnetwork Manage networksnode Manage Swarm nodesplugin Manage pluginsscan* Docker Scan (Docker Inc., v0.17.0)secret Manage Docker secretsservice Manage servicesstack Manage Docker stacksswarm Manage Swarmsystem Manage Dockertrust Manage trust on Docker imagesvolume Manage volumesCommands:attach Attach local standard input, output, and error streams to a running containerbuild Build an image from a Dockerfilecommit Create a new image from a container's changescp Copy files/folders between a container and the local filesystemcreate Create a new containerdiff Inspect changes to files or directories on a container's filesystemevents Get real time events from the serverexec Run a command in a running containerexport Export a container's filesystem as a tar archivehistory Show the history of an imageimages List imagesimport Import the contents from a tarball to create a filesystem imageinfo Display system-wide informationinspect Return low-level information on Docker objectskill Kill one or more running containersload Load an image from a tar archive or STDINlogin Log in to a Docker registrylogout Log out from a Docker registrylogs Fetch the logs of a containerpause Pause all processes within one or more containersport List port mappings or a specific mapping for the containerps List containerspull Pull an image or a repository from a registrypush Push an image or a repository to a registryrename Rename a containerrestart Restart one or more containersrm Remove one or more containersrmi Remove one or more imagesrun Run a command in a new containersave Save one or more images to a tar archive (streamed to STDOUT by default)search Search the Docker Hub for imagesstart Start one or more stopped containersstats Display a live stream of container(s) resource usage statisticsstop Stop one or more running containerstag Create a tag TARGET_IMAGE that refers to SOURCE_IMAGEtop Display the running processes of a containerunpause Unpause all processes within one or more containersupdate Update configuration of one or more containersversion Show the Docker version informationwait Block until one or more containers stop, then print their exit codesRun 'docker COMMAND --help' for more information on a command.To get more help with docker, check out our guides at https://docs.docker.com/go/guides/[root@template ~]# s
帮助文档
[root@template ~]# docker images --helpUsage: docker images [OPTIONS] [REPOSITORY[:TAG]]List imagesOptions:-a, --all Show all images (default hides intermediate images)--digests Show digests-f, --filter filter Filter output based on conditions provided--format string Pretty-print images using a Go template--no-trunc Don't truncate output-q, --quiet Only show image IDs[root@template ~]#
版本信息
[root@template ~]# docker -vDocker version 20.10.14, build a224086[root@template ~]#
版本详情
[root@template ~]# docker versionClient: Docker Engine - CommunityVersion: 20.10.14API version: 1.41Go version: go1.16.15Git commit: a224086Built: Thu Mar 24 01:49:57 2022OS/Arch: linux/amd64Context: defaultExperimental: trueServer: Docker Engine - CommunityEngine:Version: 20.10.14API version: 1.41 (minimum version 1.12)Go version: go1.16.15Git commit: 87a90dcBuilt: Thu Mar 24 01:48:24 2022OS/Arch: linux/amd64Experimental: falsecontainerd:Version: 1.5.11GitCommit: 3df54a852345ae127d1fa3092b95168e4a88e2f8runc:Version: 1.0.3GitCommit: v1.0.3-0-gf46b6badocker-init:Version: 0.19.0GitCommit: de40ad0
概要信息
[root@template ~]# docker infoClient:Context: defaultDebug Mode: falsePlugins:app: Docker App (Docker Inc., v0.9.1-beta3)buildx: Docker Buildx (Docker Inc., v0.8.1-docker)scan: Docker Scan (Docker Inc., v0.17.0)Server:Containers: 3Running: 1Paused: 0Stopped: 2Images: 2Server Version: 20.10.14Storage Driver: overlay2Backing Filesystem: xfsSupports d_type: trueNative Overlay Diff: trueuserxattr: falseLogging Driver: json-fileCgroup Driver: cgroupfsCgroup Version: 1Plugins:Volume: localNetwork: bridge host ipvlan macvlan null overlayLog: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslogSwarm: inactiveRuntimes: io.containerd.runtime.v1.linux runc io.containerd.runc.v2Default Runtime: runcInit Binary: docker-initcontainerd version: 3df54a852345ae127d1fa3092b95168e4a88e2f8runc version: v1.0.3-0-gf46b6bainit version: de40ad0Security Options:seccompProfile: defaultKernel Version: 3.10.0-957.el7.x86_64Operating System: CentOS Linux 7 (Core)OSType: linuxArchitecture: x86_64CPUs: 8Total Memory: 3.84GiBName: templateID: M5UO:W4I4:AUK2:T55U:GV3M:TJA6:CHBU:ZSJR:KHFV:MZ6Q:2535:GL6BDocker Root Dir: /var/lib/dockerDebug Mode: falseRegistry: https://index.docker.io/v1/Labels:Experimental: falseInsecure Registries:127.0.0.0/8Registry Mirrors:https://b7j3uwrc.mirror.aliyuncs.com/Live Restore Enabled: false[root@template ~]#
这里可以看到Storage Driver: overlay2,联合文件系统UFS的实现之一就是Overlay
运行监控
[root@template ~]# docker statsCONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDSd91aa5eac508 blissful_darwin 0.00% 5.332MiB / 3.84GiB 0.14% 656B / 0B 0B / 14.3kB 9
磁盘占用
[root@template ~]# cd /var/lib/docker/[root@template docker]# lsbuildkit containers image network overlay2 plugins runtimes swarm tmp trust volumes[root@template docker]# du -sh *76K buildkit28K containers572K image44K network292M overlay20 plugins0 runtimes0 swarm0 tmp0 trust24K volumes[root@template docker]#[root@template ~]# docker system dfTYPE TOTAL ACTIVE SIZE RECLAIMABLEImages 2 1 142.7MB 1.24MB (0%)Containers 3 1 2.198kB 1.093kB (49%)Local Volumes 0 0 0B 0BBuild Cache 0 0 0B 0B[root@template ~]#
磁盘清理
[root@template ~]# docker system prune
WARNING! This will remove:
- all stopped containers
- all networks not used by at least one container
- all dangling images
- all dangling build cache
Are you sure you want to continue? [y/N] y
Deleted Containers:
4828eff744c6d2017b06d074ed97f2ec355aa99eac6b29ffce7ea1c89a147f8f
acb03ef5d9fc8424dacdb5006df2aa00d470fd09ac073130bb33045b21180007
Total reclaimed space: 1.093kB
[root@template ~]#
