Docker基础命令

pull 从仓库拉取镜像到本地

仓库镜像分为:公开和私有两种

当拉取私有镜像的时候,需要仓库的账户密码
当拉取公开镜像的时候,无需仓库的账户密码

docker pull <repostory>/<image>:<tag>
docker pull nginx #拉取公开镜像
docker pull docker.cnb.cool/yungnet/product/zibll-tencent-oneid:latest #拉取私有镜像

push 从本地推送镜像到仓库

假设推送的镜像完整地址:docker.cnb.cool/yungnet/product/zibll-tencent-oneid:latest
推送镜像2大场景:
私有镜像:想自己备份一下或者团队之间共享,防止本地丢失,不想给别人使用(拉取需要账户密码)
公开镜像:想把自己的镜像制品开源,大家无需密码均可下载
本地的镜像名和要推送远程的镜像名必须一直,否则会出现推送不了的情况
Push镜像前需要登录

docker tag <旧镜像名称地址> <新镜像名称地址> #将本地镜像修改成和远程统一的地址
docker login [-u ${username}] [-p ${password}] ${repository}
docker push 新镜像名称地址
root@Debian:~/nginx# docker image ls #查看本地有没有镜像
                                                                                                    i Info →   U  In Use
IMAGE                   ID             DISK USAGE   CONTENT SIZE   EXTRA
hello-world:latest      96498ffd522e       22.6kB         10.3kB        
nginx:latest            ec4ed8b5299e        259MB         64.3MB    U   
nginx:ssj               104c3ec2781e        256MB         61.4MB    U   
ubuntu:latest           b7f48194d4d8        180MB         44.4MB    U   
yhr.123.com/nginx:xgh   3ea7da13f208        256MB         61.4MB        
root@Debian:~/nginx# docker push docker.cnb.cool/yungnet/product/zibll-tencent-oneid #尝试推送本地没有的镜像
Using default tag: latest
The push refers to repository [docker.cnb.cool/yungnet/product/zibll-tencent-oneid]
tag does not exist: docker.cnb.cool/yungnet/product/zibll-tencent-oneid:latest #失败了:因为本地不存在该镜像
root@Debian:~/nginx# docker tag nginx:ssj docker.cnb.cool/yungnet/product/zibll-tencent-oneid #重命名成要推送的镜像地址
root@Debian:~/nginx# docker image ls #重命名成功了,创建了一个链接副本
                                                                                                    i Info →   U  In Use
IMAGE                                                        ID             DISK USAGE   CONTENT SIZE   EXTRA
docker.cnb.cool/yungnet/product/zibll-tencent-oneid:latest   104c3ec2781e        256MB         61.4MB    U   
hello-world:latest                                           96498ffd522e       22.6kB         10.3kB        
nginx:latest                                                 ec4ed8b5299e        259MB         64.3MB    U   
nginx:ssj                                                    104c3ec2781e        256MB         61.4MB    U   
ubuntu:latest                                                b7f48194d4d8        180MB         44.4MB    U   
yhr.123.com/nginx:xgh                                        3ea7da13f208        256MB         61.4MB        
root@Debian:~/nginx# docker push docker.cnb.cool/yungnet/product/zibll-tencent-oneid #推送镜像
Using default tag: latest
The push refers to repository [docker.cnb.cool/yungnet/product/zibll-tencent-oneid]
41103e2ff54e: Waiting 
5d1f91636239: Waiting 
63e237f10cf6: Waiting 
75e5e08234c9: Waiting 
781dccc0a702: Waiting 
a24eb43220f0: Waiting 
81b43e7a1eae: Waiting 
3be819c1c8cf: Waiting 
74e33773ee42: Waiting 
push access denied, repository does not exist or may require authorization: authorization failed: no basic auth credentials#私有仓库,需要登录推送
root@Debian:~/nginx# docker login docker.cnb.cool #登录仓库
Username: cnb 
Password: 
​
WARNING! Your credentials are stored unencrypted in '/root/.docker/config.json'.
Configure a credential helper to remove this warning. See
https://docs.docker.com/go/credential-store/
​
Login Succeeded
root@Debian:~/nginx# docker push docker.cnb.cool/yungnet/product/zibll-tencent-oneid #再次推送
Using default tag: latest
The push refers to repository [docker.cnb.cool/yungnet/product/zibll-tencent-oneid]
781dccc0a702: Pushed 
3be819c1c8cf: Pushed 
74e33773ee42: Pushed 
81b43e7a1eae: Pushed 
a24eb43220f0: Pushed 
75e5e08234c9: Pushed 
5d1f91636239: Pushed 
63e237f10cf6: Pushed 
41103e2ff54e: Pushed 
latest: digest: sha256:104c3ec2781e7d6e2c786eb4f44d4819c72a61aa2cbdafe762795d182100979b size: 856 #推送成功

run 运行容器

注意run参数不可写在镜像后边,否则会被当作命令执行

docker run [运行参数] <镜像名>  <容器运行后的命令>
命令注解
-it交互式运行容器,分配一个伪终端。
-d后台运行容器并返回容器 ID。
--name给容器指定一个名称。
-p端口映射,格式为 host_port:container_port
-v挂载卷,格式为 host_dir:container_dir
--rm容器停止后自动删除容器。
--env 或 -e设置环境变量。
--network指定容器的网络模式。
--restart容器的重启策略(如 noon-failurealwaysunless-stopped)。
-u指定用户。

查看alpine镜像目录文件

root@Debian:~/nginx# docker run alpine ls
bin
dev
etc
home
lib
media
mnt
opt
proc
root
run
sbin
srv
sys
tmp
usr
var

start 启动容器

docker start <container_id>

stop 停止容器

docker stop <container_id>

restart 重启容器

docker restart <container_id>

rm 删除容器

# 删除容器(需要先停止)
docker rm <container_id>
# 强制删除运行中的容器
docker rm -f <container_id>

stats 实时查看容器资源使用状态

docker stats
CONTAINER ID   NAME                CPU %     MEM USAGE / LIMIT     MEM %     NET I/O         BLOCK I/O        PIDS
13871a4c65b8   mongo-openapi       0.73%     180MiB / 3.829GiB     4.59%     125MB / 325MB   411MB / 1.13GB   57
a9b65c65ed99   openapi-log         0.05%     19.38MiB / 3.829GiB   0.49%     0B / 0B         64.8MB / 86kB    7
e54a445572e2   openapi-cert        0.00%     10.63MiB / 3.829GiB   0.27%     0B / 0B         54MB / 147kB     7
cf09028c3fac   openapi-user        0.08%     16.71MiB / 3.829GiB   0.43%     0B / 0B         87.2MB / 225kB   7
d79be2fc1b96   openapi-ai          0.00%     20.14MiB / 3.829GiB   0.51%     0B / 0B         68.5MB / 487kB   11
e2b63bd8eb76   ip-search-backend   0.43%     15.82MiB / 3.829GiB   0.40%     0B / 0B         17.9MB / 250kB   9

inspect查看容器详细信息

docker inspect <container_id>
[
    {
        "Id": "e2b63bd8eb76a8e8efa92da5102a0b17d580040988561cf044f2e9b3721e0a33",
        "Created": "2026-06-23T22:39:25.451894368Z",
        "Path": "./main",
        "Args": [],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 3858,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2026-07-10T02:07:42.760555704Z",
            "FinishedAt": "2026-07-10T02:07:29.902187749Z"
        },
        "Image": "sha256:37ebf7b4bd7706b7b364e5049c1253793fba630032ad3c57bbc8a4d4dab23983",
        "ResolvConfPath": "/var/lib/docker/containers/e2b63bd8eb76a8e8efa92da5102a0b17d580040988561cf044f2e9b3721e0a33/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/e2b63bd8eb76a8e8efa92da5102a0b17d580040988561cf044f2e9b3721e0a33/hostname",
        "HostsPath": "/var/lib/docker/containers/e2b63bd8eb76a8e8efa92da5102a0b17d580040988561cf044f2e9b3721e0a33/hosts",
        "LogPath": "/var/lib/docker/containers/e2b63bd8eb76a8e8efa92da5102a0b17d580040988561cf044f2e9b3721e0a33/e2b63bd8eb76a8e8efa92da5102a0b17d580040988561cf044f2e9b3721e0a33-json.log",
        "Name": "/ip-search-backend",
        "RestartCount": 8,
        "Driver": "overlayfs",
        "Platform": "linux",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "docker-default",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": [
                "/www/wwwroot/config.yaml:/app/config.yaml:ro"
            ],
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "NetworkMode": "host",
            "PortBindings": {},
            "RestartPolicy": {
                "Name": "always",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": null,
            "ConsoleSize": [
                0,
                0
            ],
            "CapAdd": null,
            "CapDrop": null,
            "CgroupnsMode": "private",
            "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": null,
            "PidsLimit": null,
            "Ulimits": [],
            "CpuCount": 0,
            "CpuPercent": 0,
            "IOMaximumIOps": 0,
            "IOMaximumBandwidth": 0,
            "MaskedPaths": [
                "/proc/acpi",
                "/proc/asound",
                "/proc/interrupts",
                "/proc/kcore",
                "/proc/keys",
                "/proc/latency_stats",
                "/proc/sched_debug",
                "/proc/scsi",
                "/proc/timer_list",
                "/proc/timer_stats",
                "/sys/devices/virtual/powercap",
                "/sys/firmware"
            ],
            "ReadonlyPaths": [
                "/proc/bus",
                "/proc/fs",
                "/proc/irq",
                "/proc/sys",
                "/proc/sysrq-trigger"
            ]
        },
        "Storage": {
            "RootFS": {
                "Snapshot": {
                    "Name": "overlayfs"
                }
            }
        },
        "Mounts": [
            {
                "Type": "bind",
                "Source": "/www/wwwroot/config.yaml",
                "Destination": "/app/config.yaml",
                "Mode": "ro",
                "RW": false,
                "Propagation": "rprivate"
            }
        ],
        "Config": {
            "Hostname": "instance-d4wL3ojK",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "7820/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "TZ=Asia/Shanghai",
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
            ],
            "Cmd": [
                "./main"
            ],
            "Image": "docker.cnb.cool/yungnet/product/ip-search",
            "Volumes": null,
            "WorkingDir": "/app",
            "Entrypoint": null,
            "Labels": {}
        },
        "NetworkSettings": {
            "SandboxID": "5a72ff76b150111dbca7d5e2241768999b30f9716261fb2d5b1e7497b7b6f168",
            "SandboxKey": "/var/run/docker/netns/default",
            "Ports": {},
            "Networks": {
                "host": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": null,
                    "DriverOpts": null,
                    "GwPriority": 0,
                    "NetworkID": "9f374874fac6b00b36cc3170f5283d6584e22fb9c35eed3e7fe326f4164e89f1",
                    "EndpointID": "a22669c41125532dd3dcfdaf71d683ede921f523b03938b59082a70d2279ae03",
                    "Gateway": "",
                    "IPAddress": "",
                    "MacAddress": "",
                    "IPPrefixLen": 0,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "DNSNames": null
                }
            }
        },
        "ImageManifestDescriptor": {
            "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
            "digest": "sha256:37ebf7b4bd7706b7b364e5049c1253793fba630032ad3c57bbc8a4d4dab23983",
            "size": 1155,
            "platform": {
                "architecture": "amd64",
                "os": "linux"
            }
        }
    }
]

top 查看容器内进程

docker top <container_id>
UID                 PID                 PPID                C                   STIME               TTY                 TIME                CMD
root                3858                3825                0                   Jul10               ?                   00:18:01            ./main

port 查看容器端口映射

docker port <container_id>
27017/tcp -> 0.0.0.0:30720
27017/tcp -> [::]:30720

image 镜像管理

ls 查看所有镜像

docker image ls
                                                                                                    i Info →   U  In Use
IMAGE                   ID             DISK USAGE   CONTENT SIZE   EXTRA
alpine:latest           28bd5fe8b56d       13.6MB         4.27MB    U   
hello-world:latest      96498ffd522e       22.6kB         10.3kB        
nginx:latest            ec4ed8b5299e        259MB         64.3MB    U   
nginx:ssj               104c3ec2781e        256MB         61.4MB    U   
ubuntu:latest           b7f48194d4d8        180MB         44.4MB    U   
yhr.123.com/nginx:xgh   3ea7da13f208        256MB         61.4MB        

rm 删除镜像

docker image rm <镜像名>
docker image rm ubuntu
Untagged: ubuntu:latest
Deleted: sha256:b7f48194d4d8b763a478a621cdc81c27be222ba2206ca3ca6bc42b49685f3d9e
---
# 本地验证
docker image ls
                                                                                                    i Info →   U  In Use
IMAGE                   ID             DISK USAGE   CONTENT SIZE   EXTRA
alpine:latest           28bd5fe8b56d       13.6MB         4.27MB    U   
hello-world:latest      96498ffd522e       22.6kB         10.3kB        
nginx:latest            ec4ed8b5299e        259MB         64.3MB    U   
nginx:ssj               104c3ec2781e        256MB         61.4MB    U   
yhr.123.com/nginx:xgh   3ea7da13f208        256MB         61.4MB        

ps 查看容器命令

容器只是临时的,当完成命令后会自动退出停止容器
不加参数默认查看是所有正在运行的容器

参数注释
-a查看所有容器(包括未运行状态的)
# 正在运行的容器
docker ps
CONTAINER ID   IMAGE       COMMAND                  CREATED          STATUS          PORTS                                 NAMES
67d8bcd557cb   nginx:ssj   "/docker-entrypoint.…"   43 minutes ago   Up 43 minutes   0.0.0.0:80->80/tcp, [::]:80->80/tcp   agitated_germain
# 查看所有状态的容器
docker ps -a
CONTAINER ID   IMAGE          COMMAND                  CREATED             STATUS                           PORTS                                 NAMES
90f1bdcd03dc   alpine         "ls"                     25 minutes ago      Exited (0) 25 minutes ago                                              focused_nobel
67d8bcd557cb   nginx:ssj      "/docker-entrypoint.…"   44 minutes ago      Up 44 minutes                    0.0.0.0:80->80/tcp, [::]:80->80/tcp   agitated_germain
97086a4a2c41   nginx:ssj      "/docker-entrypoint.…"   48 minutes ago      Exited (137) 44 minutes ago                                            gracious_cori
9b6d56bcdaa8   nginx:ssj      "/docker-entrypoint.…"   About an hour ago   Exited (0) About an hour ago                                           zen_leakey
994cd3d8929d   4e8752eca965   "/docker-entrypoint.…"   About an hour ago   Exited (137) About an hour ago                                         trusting_ramanujan
e978da199796   nginx          "/docker-entrypoint.…"   About an hour ago   Exited (0) About an hour ago                                           romantic_banzai
b9794097a16c   nginx          "/docker-entrypoint.…"   About an hour ago   Exited (137) About an hour ago                                         busy_jang
02c3060768a8   4e8752eca965   "/docker-entrypoint.…"   About an hour ago   Exited (0) About an hour ago                                           sweet_moore
a5ca7ccf5b7e   nginx          "/docker-entrypoint.…"   About an hour ago   Exited (127) About an hour ago                                         gifted_goodall
339c56919eb6   nginx          "/docker-entrypoint.…"   About an hour ago   Exited (0) About an hour ago                                           kind_nobel
9da621cb1713   nginx          "/docker-entrypoint.…"   About an hour ago   Exited (0) About an hour ago                                           jolly_banach
表头解释
CONTAINER ID容器id(唯一的)
IMAGE镜像名
COMMAND容器启动后执行的命令
CREATED创建时间
STATUS状态信息,其中Exited(0)代表正常退出
PORTS端口映射情况(例如80:80,外部端口:容器内部端口)
NAMES容器名称(未指定名称时则随机)

inspect 查看镜像信息

参数注释
--format='{{.Config.Cmd}}'查看镜像默认执行命令
# 查看Alpine镜像的信息
root@Debian:~/nginx# docker inspect alpine
[
    {
        "Id": "sha256:28bd5fe8b56d1bd048e5babf5b10710ebe0bae67db86916198a6eec434943f8b",
        "RepoTags": [
            "alpine:latest"
        ],
        "RepoDigests": [
            "alpine@sha256:28bd5fe8b56d1bd048e5babf5b10710ebe0bae67db86916198a6eec434943f8b"
        ],
        "Comment": "buildkit.dockerfile.v0",
        "Created": "2026-06-16T00:01:20.474100947Z",
        "Config": {
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
            ],
            "Cmd": [
                "/bin/sh"
            ],
            "WorkingDir": "/"
        },
        "Architecture": "arm64",
        "Variant": "v8",
        "Os": "linux",
        "Size": 4193907,
        "RootFS": {
            "Type": "layers",
            "Layers": [
                "sha256:b2848c02ac6ff53d265469b5b30f649f335e546a83330cd8916d54e65e640409"
            ]
        },
        "Metadata": {
            "LastTagTime": "2026-07-10T11:49:37.158435736Z"
        },
        "Descriptor": {
            "mediaType": "application/vnd.oci.image.index.v1+json",
            "digest": "sha256:28bd5fe8b56d1bd048e5babf5b10710ebe0bae67db86916198a6eec434943f8b",
            "size": 9218
        },
        "Identity": {
            "Pull": [
                {
                    "Repository": "docker.io/library/alpine"
                }
            ]
        }
    }
]
# 查看Alpine镜像启动后默认执行的命令
root@Debian:~/nginx# docker inspect alpine  --format='{{.Config.Cmd}}'
[/bin/sh]

attach 连接到正在运行的容器

docker attach 用于连接到一个正在运行的容器,主要作用是 访问容器的主进程(PID=1)的标准输入输出流

docker attach <container_id>

注意当attach中ctrl+c或输入exit等导致的退出,会容器自动退出停止,因为这是追加到默认分配到终端上

exec 新开一个伪终端

docker exec -it <container_id> <command>
docker exec -it d56 sh

因为分配了一个新的伪终端与原来的互不干扰,因此exec中的退出不会导致整个容器停止

build 构建一个镜像

docker build -t <镜像名> -f <可选指定Dockerfile> <构建目录> 
# 在当前目录下构建名为myimage镜像
docker build -t myimage .
# 在nginx目录下构建名为myimage镜像,并指定Dockerfile.util文件
docker build -t myimage -f Dockerfile.util nginx

volume 存储卷管理

ls 列出所有卷

docker volume ls
DRIVER              VOLUME NAME
local               my_volume
local               another_volume

create 创建存储卷

docker volume create <volume_name>
# 创建名为nginx_data存储卷
➜  golang_sample git:(main) ✗ docker volume create nginx_data
nginx_data

inspect 查看卷详情

docker volume inspect <volume_name>
docker volume inspect my_volume
[
    {
        "CreatedAt": "2024-07-23T00:00:00Z",
        "Driver": "local",
        "Labels": {},
        "Mountpoint": "/var/lib/docker/volumes/my_volume/_data",
        "Name": "my_volume",
        "Options": {},
        "Scope": "local"
    }
]

rm 删除卷

docker volume rm <volume_name>

prune 删除未使用的卷

docker volume prune

network 网络管理

ls 查看所有网络

docker network ls
NETWORK ID     NAME        DRIVER    SCOPE
c68e306de710   baota_net   bridge    local
e56fa071ca17   bridge      bridge    local
9f374874fac6   host        host      local
1085fc751c62   none        null      local

inspect 查看网络详情

docker network inspect <network_name>
docker network inspect my_network
[
    {
        "Name": "my_network",
        "Id": "b649b57f5bc5",
        "Created": "2024-07-23T00:00:00.000000000Z",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": {},
            "Config": [
                {
                    "Subnet": "172.18.0.0/16",
                    "Gateway": "172.18.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Containers": {},
        "Options": {},
        "Labels": {}
    }
]

create 创建一个新的网络

docker network create <network_name>

常用参数

  • --driver: 指定网络驱动程序(如 bridgehostoverlay)。
  • --subnet: 指定子网。
  • --gateway: 指定网关。
  • --ip-range: 指定可用 IP 地址范围。
  • --ipv6: 启用 IPv6。
  • --label: 为网络添加标签。
# 创建一个名为my-bridge-network的网络,指定驱动为bridge,子网为172.20.0.0/16,网关为172.20.0.1
docker network create \
    --driver bridge \
    --subnet=172.20.0.0/16 \
    --gateway=172.20.0.1 \
    my-bridge-network

rm 删除网络

docker network rm <network_name>

connect 将容器连接到网络

docker network connect <container_name>

disconnect 断开容器与网络的连接

docker network disconnect <container_name>

prune 删除所有未使用的网络

docker network prune

logs 日志查看

# 查看容器日志
docker logs <container_id>
​
# 实时查看最新日志
docker logs -f <container_id>
​
# 查看最近 100 行日志
docker logs --tail 100 <container_id>
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
2026/07/13 00:41:59 [notice] 1#1: using the "epoll" event method
2026/07/13 00:41:59 [notice] 1#1: nginx/1.31.2
2026/07/13 00:41:59 [notice] 1#1: built by gcc 14.2.0 (Debian 14.2.0-19) 
2026/07/13 00:41:59 [notice] 1#1: OS: Linux 6.12.86+deb13-amd64
2026/07/13 00:41:59 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 655360:655360
2026/07/13 00:41:59 [notice] 1#1: start worker processes
2026/07/13 00:41:59 [notice] 1#1: start worker process 29
2026/07/13 00:41:59 [notice] 1#1: start worker process 30
2026/07/13 00:41:59 [notice] 1#1: start worker process 31
2026/07/13 00:41:59 [notice] 1#1: start worker process 32
# 显示时间戳
docker logs -t <container_id>
2026-07-13T00:41:59.477160143Z /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
2026-07-13T00:41:59.477201346Z /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
2026-07-13T00:41:59.482658355Z /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
2026-07-13T00:41:59.490136230Z 10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
2026-07-13T00:41:59.505450441Z 10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
2026-07-13T00:41:59.505766328Z /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh
2026-07-13T00:41:59.505775247Z /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
2026-07-13T00:41:59.511330068Z /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
2026-07-13T00:41:59.513969709Z /docker-entrypoint.sh: Configuration complete; ready for start up
2026-07-13T00:41:59.526432275Z 2026/07/13 00:41:59 [notice] 1#1: using the "epoll" event method
2026-07-13T00:41:59.526454949Z 2026/07/13 00:41:59 [notice] 1#1: nginx/1.31.2
2026-07-13T00:41:59.526459259Z 2026/07/13 00:41:59 [notice] 1#1: built by gcc 14.2.0 (Debian 14.2.0-19) 
2026-07-13T00:41:59.526462837Z 2026/07/13 00:41:59 [notice] 1#1: OS: Linux 6.12.86+deb13-amd64
2026-07-13T00:41:59.526466161Z 2026/07/13 00:41:59 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 655360:655360
2026-07-13T00:41:59.526617584Z 2026/07/13 00:41:59 [notice] 1#1: start worker processes
2026-07-13T00:41:59.526952685Z 2026/07/13 00:41:59 [notice] 1#1: start worker process 29
2026-07-13T00:41:59.528234477Z 2026/07/13 00:41:59 [notice] 1#1: start worker process 30
2026-07-13T00:41:59.529000715Z 2026/07/13 00:41:59 [notice] 1#1: start worker process 31
2026-07-13T00:41:59.529011118Z 2026/07/13 00:41:59 [notice] 1#1: start worker process 32

广告:

THE END
喜欢就支持一下吧
点赞6打赏 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容