一、基础环境
0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 $ uname -aLinux 172-20-100-118 4.18.0-546.el8.x86_64 #1 SMP Fri Mar 15 02:27:26 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux$ cat /etc/redhat-releaseCentOS Stream release 8$ dnf install -y yum-utils device-mapper-persistent-data lvm2$ dnf config-manager --add-repo=https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo$ yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo$ sed -i 's+download.docker.com+mirrors.tuna.tsinghua.edu.cn/docker-ce+' /etc/yum.repos.d/docker-ce.repo$ dnf install docker-ce$ systemctl start docker$ docker versionClient: Docker Engine - CommunityVersion: 26.0.0API version: 1.45Go version: go1.21.8Git commit: 2ae903eBuilt: Wed Mar 20 15:19:04 2024OS/Arch: linux/amd64Context: defaultServer: Docker Engine - CommunityEngine:Version: 26.0.0API version: 1.45 (minimum version 1.24)Go version: go1.21.8Git commit: 8b79278Built: Wed Mar 20 15:17:57 2024OS/Arch: linux/amd64Experimental: falsecontainerd:Version: 1.6.28GitCommit: ae07eda36dd25f8a1b98dfbf587313b99c0190bbrunc:Version: 1.1.12GitCommit: v1.1.12-0-g51d5e94docker-init:Version: 0.19.0GitCommit: de40ad0$ docker infoClient: Docker Engine - CommunityVersion: 26.0.0Context: defaultDebug Mode: falsePlugins:buildx: Docker Buildx (Docker Inc.)Version: v0.13.1Path: /usr/libexec/docker/cli-plugins/docker-buildxcompose: Docker Compose (Docker Inc.)Version: v2.25.0Path: /usr/libexec/docker/cli-plugins/docker-composeServer:Containers: 0Running: 0Paused: 0Stopped: 0Images: 0Server Version: 26.0.0Storage Driver: overlay2Backing Filesystem: xfsSupports d_type: trueUsing metacopy: falseNative 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 splunk syslogSwarm: inactiveRuntimes: io.containerd.runc.v2 runcDefault Runtime: runcInit Binary: docker-initcontainerd version: ae07eda36dd25f8a1b98dfbf587313b99c0190bbrunc version: v1.1.12-0-g51d5e94init version: de40ad0Security Options:seccompProfile: builtinKernel Version: 4.18.0-546.el8.x86_64Operating System: CentOS Stream 8OSType: linuxArchitecture: x86_64CPUs: 4Total Memory: 3.549GiBName: 172-20-100-118ID: d4882554-7660-4be9-a67e-c80a5ae0956eDocker Root Dir: /var/lib/dockerDebug Mode: falseExperimental: falseInsecure Registries:127.0.0.0/8Live Restore Enabled: false$ mkdir /data/docker -p
⚫ OCI:Open Container Initiative的简称,由Linux基金会主导开发OCI规范和标准,目的是
围绕容器格式和Runtime(运行时)制定的一个开放的工业化标准。
⚫ Containerd:Docker为了兼容OCI标准,将容器Runtime及其管理功能从Docker守护进程中
剥离出来,用于不启动Docker也能直接通过Containerd来管理容器。
⚫ RunC:Docker按照OCF(Open Container Format)开放容器格式标准制定的一个轻量级
工具,可以使用RunC不通过Docker引擎即可实现容器的启动、停止和资源隔离等功能。 SourceByrd's Weblog-https://note.t4x.org/cloud/about-config-docker/
二、环境配置
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
$ mv /var/lib/docker/* /data/docker/ $ cat /etc/docker/daemon.json { "data-root": "/data/docker", "exec-opts": ["native.cgroupdriver=systemd"], "registry-mirrors": [ "https://docker.mirrors.ustc.edu.cn", "https://bhtknto5.mirror.aliyuncs.com", "https://yo3sdl2l.mirror.aliyuncs.com", "https://blkjc4x3.mirror.aliyuncs.com" ], "insecure-registries": [ "http://172.20.0.15", "https://harbor.t4x.org" ], "default-runtime": "runc", "log-driver": "json-file", "log-opts": { "max-size":"10m", "max-file":"5", "labels": "somelabel", "env": "os,customer" }, "debug": false, "selinux-enabled": false, "userns-remap": "", "group": "", "cgroup-parent": "", "default-ulimits": { "nofile": { "Name": "nofile", "Hard": 64000, "Soft": 64000 } }, "init": false, "init-path": "/usr/libexec/docker-init", "ipv6": false, "iptables": false, "ip-forward": true, "ip-masq": true, "userland-proxy": false, "userland-proxy-path": "/usr/libexec/docker-proxy", "bip": "192.168.10.1/24", "default-address-pools": [ { "base": "192.168.199.0/24", "size":24 } ] } |
fix:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
$ cat /etc/docker/daemon.json { "data-root": "/data/docker", "exec-opts": ["native.cgroupdriver=systemd"], "registry-mirrors": [ "https://docker.mirrors.ustc.edu.cn", "https://bhtknto5.mirror.aliyuncs.com", "https://yo3sdl2l.mirror.aliyuncs.com", "https://blkjc4x3.mirror.aliyuncs.com" ], "insecure-registries": [ "http://172.20.0.15", "https://harbor.t4x.org" ], "default-runtime": "runc", "log-driver": "json-file", "log-opts": { "max-size":"10m", "max-file":"5", "labels": "somelabel", "env": "os,customer" }, "debug": false, "selinux-enabled": false, "userns-remap": "", "group": "", "cgroup-parent": "", "default-ulimits": { "nofile": { "Name": "nofile", "Hard": 64000, "Soft": 64000 } }, "init": false, "ipv6": false, "iptables": false, "ip-forward": true, "ip-masq": true, "userland-proxy": false, "bip": "192.168.10.1/24" } |
三、Docker基础命令
SourceByrd's Weblog-https://note.t4x.org/cloud/about-config-docker/
0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 $ docker login harbor.t4x.orgUsername: adminPassword:WARNING! Your password will be stored unencrypted in /root/.docker/config.json.Configure a credential helper to remove this warning. Seehttps://docs.docker.com/engine/reference/commandline/login/#credentials-storeLogin Succeeded$ docker pull harbor.t4x.org/k8s/coredns:1.11.1$ docker pull harbor.t4x.org/base/busybox:latestlatest: Pulling from base/busybox5cc84ad355aa: Pull completeDigest: sha256:62ffc2ed7554e4c6d360bce40bbcf196573dd27c4ce080641a2c59867e732deeStatus: Downloaded newer image for harbor.t4x.org/base/busybox:latestharbor.t4x.org/base/busybox:latest$ docker image lsREPOSITORY TAG IMAGE ID CREATED SIZEharbor.t4x.org/k8s/coredns 1.11.1 cbb01a7bd410 8 months ago 59.8MBharbor.t4x.org/base/busybox latest beae173ccac6 2 years ago 1.24MB$ docker run --rm -it harbor.t4x.org/base/busybox sh/ # ip a1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00inet 127.0.0.1/8 scope host lovalid_lft forever preferred_lft forever4: eth0@if5: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1500 qdisc noqueuelink/ether 02:42:c0:a8:01:01 brd ff:ff:ff:ff:ff:ffinet 192.168.1.1/24 brd 192.168.1.255 scope global eth0valid_lft forever preferred_lft forever/ # exit$ docker container lsCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES$ docker run --rm -it harbor.t4x.org/base/busybox sh/ # exit$ docker ps -aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES$ docker run -it harbor.t4x.org/base/busybox sh/ # exit$ docker ps -aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES9d9085674a71 harbor.t4x.org/base/busybox "sh" 5 seconds ago Exited (0) 1 second ago great_robinson$ docker ps -aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES9d9085674a71 harbor.t4x.org/base/busybox "sh" 2 minutes ago Exited (0) 2 minutes ago great_robinson$ docker container rm great_robinsongreat_robinson$ docker ps -aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES$ docker run -it harbor.t4x.org/base/busybox sh/ # exit$ docker ps -aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES06240df46065 harbor.t4x.org/base/busybox "sh" 5 seconds ago Exited (0) 1 second ago awesome_elgamal$ docker container rm 06240df4606506240df46065$ docker ps -aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES$ docker run -itd harbor.t4x.org/base/busybox sh83141fa990a406ad01ead544283b16615060af836036b4eabb0d2d7a44fa511f$ docker container lsCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES83141fa990a4 harbor.t4x.org/base/busybox "sh" 11 seconds ago Up 10 seconds youthful_tesla$ docker exec -ti 83141fa990a4 sh/ # exit$ docker container lsCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES83141fa990a4 harbor.t4x.org/base/busybox "sh" 50 seconds ago Up 49 seconds youthful_tesla$ docker attach 83141fa990a4/ # exit$ docker container lsCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES$ docker run -itd harbor.t4x.org/base/busybox shc7236b50ef919bfb6468434937983876d8cd8df7fcc6e58e0101bda2609b0e26$ docker container lsCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESc7236b50ef91 harbor.t4x.org/base/busybox "sh" 4 seconds ago Up 2 seconds nostalgic_bardeen$ docker container lsCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESc7236b50ef91 harbor.t4x.org/base/busybox "sh" 35 seconds ago Up 33 seconds nostalgic_bardeen$ docker container stop c7236b50ef91c7236b50ef91$ docker container lsCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES$ docker ps -aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESc7236b50ef91 harbor.t4x.org/base/busybox "sh" About a minute ago Exited (137) 10 seconds ago nostalgic_bardeen83141fa990a4 harbor.t4x.org/base/busybox "sh" 4 minutes ago Exited (0) 2 minutes ago youthful_tesla$ docker container start c7236b50ef91c7236b50ef91$ docker container lsCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESc7236b50ef91 harbor.t4x.org/base/busybox "sh" About a minute ago Up 3 seconds nostalgic_bardeen$ docker ps -aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESc7236b50ef91 harbor.t4x.org/base/busybox "sh" About a minute ago Up 6 seconds nostalgic_bardeen83141fa990a4 harbor.t4x.org/base/busybox "sh" 4 minutes ago Exited (0) 2 minutes ago youthful_tesla$ docker container ls -aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESc7236b50ef91 harbor.t4x.org/base/busybox "sh" 3 minutes ago Up 2 minutes nostalgic_bardeen83141fa990a4 harbor.t4x.org/base/busybox "sh" 6 minutes ago Exited (0) 5 minutes ago youthful_tesla$ docker container start 83141fa990a483141fa990a4$ docker container ls -aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESc7236b50ef91 harbor.t4x.org/base/busybox "sh" 4 minutes ago Up 3 minutes nostalgic_bardeen83141fa990a4 harbor.t4x.org/base/busybox "sh" 7 minutes ago Up 2 seconds youthful_tesla$ docker container rm c7236b50ef91Error response from daemon: You cannot remove a running container c7236b50ef919bfb6468434937983876d8cd8df7fcc6e58e0101bda2609b0e26. Stop the container before attempting removal or force remove$ docker container stop c7236b50ef91c7236b50ef91$ docker container ls -aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESc7236b50ef91 harbor.t4x.org/base/busybox "sh" 6 minutes ago Exited (137) 5 seconds ago nostalgic_bardeen83141fa990a4 harbor.t4x.org/base/busybox "sh" 9 minutes ago Up About a minute youthful_tesla$ docker container rm c7236b50ef91c7236b50ef91$ docker container ls -aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES83141fa990a4 harbor.t4x.org/base/busybox "sh" 9 minutes ago Up About a minute youthful_tesla$ docker run -itd harbor.t4x.org/base/busybox sh0a2bd2371ace1e580f4430ea083b1632efeac54da357de28aefcce90a4e1d472$ docker container ls -aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES0a2bd2371ace harbor.t4x.org/base/busybox "sh" 7 seconds ago Up 6 seconds focused_thompson83141fa990a4 harbor.t4x.org/base/busybox "sh" 11 minutes ago Up 3 minutes youthful_tesla$ docker container stop 0a2bd2371ace0a2bd2371ace$ docker container ls -aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES0a2bd2371ace harbor.t4x.org/base/busybox "sh" About a minute ago Exited (137) 39 seconds ago focused_thompson83141fa990a4 harbor.t4x.org/base/busybox "sh" 12 minutes ago Up 4 minutes youthful_tesla$ docker ps -aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES0a2bd2371ace harbor.t4x.org/base/busybox "sh" About a minute ago Exited (137) 45 seconds ago focused_thompson83141fa990a4 harbor.t4x.org/base/busybox "sh" 12 minutes ago Up 4 minutes youthful_tesla$ docker container pruneWARNING! This will remove all stopped containers.Are you sure you want to continue? [y/N] yDeleted Containers:0a2bd2371ace1e580f4430ea083b1632efeac54da357de28aefcce90a4e1d472Total reclaimed space: 0B$ docker ps -aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES83141fa990a4 harbor.t4x.org/base/busybox "sh" 12 minutes ago Up 5 minutes youthful_tesla$ docker ps -aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES83141fa990a4 harbor.t4x.org/base/busybox "sh" 12 minutes ago Up 5 minutes youthful_tesla$ docker ps -aq83141fa990a4$ docker ps -aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES83141fa990a4 harbor.t4x.org/base/busybox "sh" 13 minutes ago Up 6 minutes youthful_tesla$ docker container rm $(docker ps -aq)Error response from daemon: You cannot remove a running container 83141fa990a406ad01ead544283b16615060af836036b4eabb0d2d7a44fa511f. Stop the container before attempting removal or force remove$ docker ps -aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES83141fa990a4 harbor.t4x.org/base/busybox "sh" 14 minutes ago Up 7 minutes youthful_tesla
1. 搜索容器SourceByrd's Weblog-https://note.t4x.org/cloud/about-config-docker/
SourceByrd's Weblog-https://note.t4x.org/cloud/about-config-docker/
012345678910111213141516171819202122232425 $ docker search nginxNAME DESCRIPTION STARS OFFICIALnginx Official build of Nginx. 19745 [OK]unit Official build of NGINX Unit: Universal Web … 25 [OK]nginx/nginx-ingress NGINX and NGINX Plus Ingress Controllers fo… 89nginxinc/nginx-unprivileged Unprivileged NGINX Dockerfiles 144nginx/nginx-prometheus-exporter NGINX Prometheus Exporter for NGINX and NGIN… 40nginxinc/nginx-s3-gateway Authenticating and caching gateway based on … 6nginx/unit This repository is retired, use the Docker o… 64nginx/nginx-ingress-operator NGINX Ingress Operator for NGINX and NGINX P… 2nginxinc/amplify-agent NGINX Amplify Agent docker repository 1nginx/nginx-quic-qns NGINX QUIC interop 1nginxinc/ingress-demo Ingress Demo 4nginxproxy/nginx-proxy Automated nginx proxy for Docker containers … 132nginxproxy/acme-companion Automated ACME SSL certificate generation fo… 131bitnami/nginx Bitnami nginx Docker Image 185bitnami/nginx-ingress-controller Bitnami Docker Image for NGINX Ingress Contr… 32ubuntu/nginx Nginx, a high-performance reverse proxy & we… 112nginxproxy/docker-gen Generate files from docker container meta-da… 16nginxinc/mra-fakes3 0kasmweb/nginx An Nginx image based off nginx:alpine and in… 7nginxinc/nginmesh_proxy_init 0nginxinc/nginmesh_proxy_debug 0rancher/nginx-ingress-controller 13rancher/nginx-ingress-controller-defaultbackend 2bitnami/nginx-exporter 52. 拉取镜像
SourceByrd's Weblog-https://note.t4x.org/cloud/about-config-docker/
01234567891011 $ docker pull nginx:1.1..11.Using default tag: latestlatest: Pulling from library/nginxa2abf6c4d29d: Pull completea9edb18cadd1: Pull complete589b7251471a: Pull complete186b1aaa4aa6: Pull completeb4df32aa5a72: Pull completea0bcbecc962e: Pull completeDigest: sha256:0d17b565c37bcbd895e9d92315a05c1c3c9a29f762b011a10c54a66cd53c9b31Status: Downloaded newer image for nginx:latestdocker.io/library/nginx:latest3. 查看本地镜像
SourceByrd's Weblog-https://note.t4x.org/cloud/about-config-docker/
012 $ docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEnginx latest 605c77e624dd 2 years ago 141MB4. 进入容器
SourceByrd's Weblog-https://note.t4x.org/cloud/about-config-docker/
01 $ docker run -ti nginx bashroot@f9a4dc1df0e9:/#5. 端口映射
SourceByrd's Weblog-https://note.t4x.org/cloud/about-config-docker/
01 # docker run -ti -p 1111:80 nginx bashroot@c19878e3c6a3:/#6. 显示所有容器
SourceByrd's Weblog-https://note.t4x.org/cloud/about-config-docker/
0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259 # docker ps -aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESc19878e3c6a3 nginx "/docker-entrypoint.…" About a minute ago Exited (127) About a minute ago funny_pasteurf9a4dc1df0e9 nginx "/docker-entrypoint.…" 3 minutes ago Exited (127) 3 minutes ago wizardly_euclid$ docker run -d -p 8080:80 nginx7d7678b037cfc16ea3edc4ca29c8e3b737cfd39f80b239c5bd8afdd03cae4fac$ docker ps -aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES7d7678b037cf nginx "/docker-entrypoint.…" 6 seconds ago Up 5 seconds 0.0.0.0:8080->80/tcp awesome_darwinc19878e3c6a3 nginx "/docker-entrypoint.…" 5 minutes ago Exited (127) 5 minutes ago funny_pasteurf9a4dc1df0e9 nginx "/docker-entrypoint.…" 7 minutes ago Exited (127) 7 minutes ago wizardly_euclid$ netstat -tunlpActive Internet connections (only servers)Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program nametcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 1394/dockerdtcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 615/sshdtcp6 0 0 :::22 :::* LISTEN 615/sshdudp 0 0 127.0.0.1:323 0.0.0.0:* 580/chronydudp6 0 0 ::1:323 :::* 580/chronyd$ docker inspect 7d7678b037cf[{"Id": "7d7678b037cfc16ea3edc4ca29c8e3b737cfd39f80b239c5bd8afdd03cae4fac","Created": "2024-04-03T09:22:34.170458173Z","Path": "/docker-entrypoint.sh","Args": ["nginx","-g","daemon off;"],"State": {"Status": "running","Running": true,"Paused": false,"Restarting": false,"OOMKilled": false,"Dead": false,"Pid": 1929,"ExitCode": 0,"Error": "","StartedAt": "2024-04-03T09:22:35.132278485Z","FinishedAt": "0001-01-01T00:00:00Z"},"Image": "sha256:605c77e624ddb75e6110f997c58876baa13f8754486b461117934b24a9dc3a85","ResolvConfPath": "/data/docker/containers/7d7678b037cfc16ea3edc4ca29c8e3b737cfd39f80b239c5bd8afdd03cae4fac/resolv.conf","HostnamePath": "/data/docker/containers/7d7678b037cfc16ea3edc4ca29c8e3b737cfd39f80b239c5bd8afdd03cae4fac/hostname","HostsPath": "/data/docker/containers/7d7678b037cfc16ea3edc4ca29c8e3b737cfd39f80b239c5bd8afdd03cae4fac/hosts","LogPath": "/data/docker/containers/7d7678b037cfc16ea3edc4ca29c8e3b737cfd39f80b239c5bd8afdd03cae4fac/7d7678b037cfc16ea3edc4ca29c8e3b737cfd39f80b239c5bd8afdd03cae4fac-json.log","Name": "/awesome_darwin","RestartCount": 0,"Driver": "overlay2","Platform": "linux","MountLabel": "","ProcessLabel": "","AppArmorProfile": "","ExecIDs": null,"HostConfig": {"Binds": null,"ContainerIDFile": "","LogConfig": {"Type": "json-file","Config": {"env": "os,customer","labels": "somelabel","max-file": "5","max-size": "10m"}},"NetworkMode": "default","PortBindings": {"80/tcp": [{"HostIp": "","HostPort": "8080"}]},"RestartPolicy": {"Name": "no","MaximumRetryCount": 0},"AutoRemove": false,"VolumeDriver": "","VolumesFrom": null,"ConsoleSize": [36,179],"CapAdd": null,"CapDrop": null,"CgroupnsMode": "host","Dns": [],"DnsOptions": [],"DnsSearch": [],"ExtraHosts": null,"GroupAdd": null,"IpcMode": "private","Cgroup": "","Links": null,"OomScoreAdj": 0,"PidMode": "","Privileged": false,"PublishAllPorts": false,"ReadonlyRootfs": false,"SecurityOpt": null,"UTSMode": "","UsernsMode": "","ShmSize": 67108864,"Runtime": "runc","Isolation": "","CpuShares": 0,"Memory": 0,"NanoCpus": 0,"CgroupParent": "","BlkioWeight": 0,"BlkioWeightDevice": [],"BlkioDeviceReadBps": [],"BlkioDeviceWriteBps": [],"BlkioDeviceReadIOps": [],"BlkioDeviceWriteIOps": [],"CpuPeriod": 0,"CpuQuota": 0,"CpuRealtimePeriod": 0,"CpuRealtimeRuntime": 0,"CpusetCpus": "","CpusetMems": "","Devices": [],"DeviceCgroupRules": null,"DeviceRequests": null,"MemoryReservation": 0,"MemorySwap": 0,"MemorySwappiness": null,"OomKillDisable": false,"PidsLimit": null,"Ulimits": [{"Name": "nofile","Hard": 64000,"Soft": 64000}],"CpuCount": 0,"CpuPercent": 0,"IOMaximumIOps": 0,"IOMaximumBandwidth": 0,"MaskedPaths": ["/proc/asound","/proc/acpi","/proc/kcore","/proc/keys","/proc/latency_stats","/proc/timer_list","/proc/timer_stats","/proc/sched_debug","/proc/scsi","/sys/firmware","/sys/devices/virtual/powercap"],"ReadonlyPaths": ["/proc/bus","/proc/fs","/proc/irq","/proc/sys","/proc/sysrq-trigger"]},"GraphDriver": {"Data": {"LowerDir": "/data/docker/overlay2/89edc02c1eb7a8e1efa00a82bdd2b4f9fbcf38a84d9a555e7ff58ead80a55ba2-init/diff:/data/docker/overlay2/6770b4e7bb808c973136c26df691cdcf222ec1f15b2a433f25e3d4802c2d9dc7/diff:/data/docker/overlay2/e990e0d3f685d6c789a92b87c2ab30b486e39337bc32aca975a90fae132285fa/diff:/data/docker/overlay2/aa71e1ee390082f0171d84b9d324a298683bd06dad877ede006623f1395b4a5d/diff:/data/docker/overlay2/806242eab0709899507b09b3b8f2f2caf0fc46221b9c8105e9fe6d075fea7ca1/diff:/data/docker/overlay2/66bb3781881c7041b05da30b2d0efafe2666deadc31f7e242c89669b2619c0f1/diff:/data/docker/overlay2/2bbae9131a228d844dda7c68ca7c0dabcc1ac11d5c2e30ed3c71855a79568611/diff","MergedDir": "/data/docker/overlay2/89edc02c1eb7a8e1efa00a82bdd2b4f9fbcf38a84d9a555e7ff58ead80a55ba2/merged","UpperDir": "/data/docker/overlay2/89edc02c1eb7a8e1efa00a82bdd2b4f9fbcf38a84d9a555e7ff58ead80a55ba2/diff","WorkDir": "/data/docker/overlay2/89edc02c1eb7a8e1efa00a82bdd2b4f9fbcf38a84d9a555e7ff58ead80a55ba2/work"},"Name": "overlay2"},"Mounts": [],"Config": {"Hostname": "7d7678b037cf","Domainname": "","User": "","AttachStdin": false,"AttachStdout": false,"AttachStderr": false,"ExposedPorts": {"80/tcp": {}},"Tty": false,"OpenStdin": false,"StdinOnce": false,"Env": ["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin","NGINX_VERSION=1.21.5","NJS_VERSION=0.7.1","PKG_RELEASE=1~bullseye"],"Cmd": ["nginx","-g","daemon off;"],"Image": "nginx","Volumes": null,"WorkingDir": "","Entrypoint": ["/docker-entrypoint.sh"],"OnBuild": null,"Labels": {"maintainer": "NGINX Docker Maintainers <docker-maint@nginx.com>"},"StopSignal": "SIGQUIT"},"NetworkSettings": {"Bridge": "","SandboxID": "e77a3b70bcdc2541c89e4c4a73f8d372dc385e9df6dbbf78af95e2e3b5404cd2","SandboxKey": "/var/run/docker/netns/e77a3b70bcdc","Ports": {"80/tcp": [{"HostIp": "0.0.0.0","HostPort": "8080"}]},"HairpinMode": false,"LinkLocalIPv6Address": "","LinkLocalIPv6PrefixLen": 0,"SecondaryIPAddresses": null,"SecondaryIPv6Addresses": null,"EndpointID": "a2c2580ad8db4504e8b9152f52d51b602bc4a0f2891c7d4b8045def799f2dcea","Gateway": "192.168.10.1","GlobalIPv6Address": "","GlobalIPv6PrefixLen": 0,"IPAddress": "192.168.10.2","IPPrefixLen": 24,"IPv6Gateway": "","MacAddress": "02:42:c0:a8:0a:02","Networks": {"bridge": {"IPAMConfig": null,"Links": null,"Aliases": null,"MacAddress": "02:42:c0:a8:0a:02","NetworkID": "f45ce0987ea5662405191d5d886e902f7771e756e0f2a4ea06faea89cfc45b24","EndpointID": "a2c2580ad8db4504e8b9152f52d51b602bc4a0f2891c7d4b8045def799f2dcea","Gateway": "192.168.10.1","IPAddress": "192.168.10.2","IPPrefixLen": 24,"IPv6Gateway": "","GlobalIPv6Address": "","GlobalIPv6PrefixLen": 0,"DriverOpts": null,"DNSNames": null}}}}]
四、DockerFile编写
SourceByrd's Weblog-https://note.t4x.org/cloud/about-config-docker/
0
五、Docker镜像优化
SourceByrd's Weblog-https://note.t4x.org/cloud/about-config-docker/SourceByrd's Weblog-https://note.t4x.org/cloud/about-config-docker/申明:除非注明Byrd's Blog内容均为原创,未经许可禁止转载!详情请阅读版权申明!