百度360必应搜狗淘宝本站头条
当前位置:网站首页 > 编程字典 > 正文

Docker实践之镜像启动及常用命令

toyiye 2024-06-21 11:57 9 浏览 0 评论

前面简单的介绍了如何在Linux中安装Docker,这节内容,我们学习Docker镜像启动

我们Docker启动镜像从哪里来呢?镜像由我们自己或者他人构建,构建好的镜像可以直接放在本地或者上传到远程镜像仓库。当我们运行一个Docker镜像时,会先在本地查找是否存在所要运行的镜像,如果没有则会去远程镜像仓库拉取,默认为官方的镜像仓库,当然,我们也可以改为自己的私有镜像仓库。接下来,我们先了解几个简单的命令。

  • docker images 列出本地主机中的镜像
  • docker pull [OPTIONS] 拉取镜像仓库中的镜像
  • docker search [OPTIONS] 搜索仓库中的镜像
  • docker rmi [OPTIONS] 删除本地镜像
  • docker rm [OPTIONS] 删除容器
  • docker run [OPTIONS] 启动镜像,先检查本地是否存在镜像,不存在则远程仓库下载
  • docker build [OPTIONS] 构建镜像
  • docker ps [OPTIONS] 运行中的镜像容器
  • docker cp [OPTIONS] 宿主机与容器之间的文件复制

启动Nginx镜像

我们直接在安装好Docker的主机上执行docker run nginx


我们从运行日志可以看到这样的字眼:

1
2
Unable to find image 'nginx:latest' locally
latest: Pulling from library/nginx

docker发现本地不存在nginx的镜像文件,便直接去仓库中查找下载并运行,因为我们没有让镜像后台运行,所以这次运行起来的容器会随着这次远程连接断开而停止。当我按下ctrl+c时,容器便会停止

1
2
3
4
5
6
7
8
9
10
^C2021/12/28 03:24:32 [notice] 1#1: signal 2 (SIGINT) received, exiting
2021/12/28 03:24:32 [notice] 31#31: exiting
2021/12/28 03:24:32 [notice] 32#32: exiting
2021/12/28 03:24:32 [notice] 31#31: exit
2021/12/28 03:24:32 [notice] 32#32: exit
2021/12/28 03:24:32 [notice] 1#1: signal 17 (SIGCHLD) received from 31
2021/12/28 03:24:32 [notice] 1#1: worker process 31 exited with code 0
2021/12/28 03:24:32 [notice] 1#1: worker process 32 exited with code 0
2021/12/28 03:24:32 [notice] 1#1: exit

如果要让容器后台运行,则需要在启动时加-d这个参数,

1
2
3
[root@VM-12-3-centos ~]# docker run -d nginx
8dd8b3dd27aa28f913bea43de632d105c17901561d69c502b4433e0f473ed453

我们来看一下当前运行中的容器

1
2
3
4
[root@VM-12-3-centos ~]# docker ps
CONTAINER ID   IMAGE     COMMAND                  CREATED          STATUS          PORTS     NAMES
8dd8b3dd27aa   nginx     "/docker-entrypoint.…"   23 seconds ago   Up 23 seconds   80/tcp    goofy_faraday

可以看到,我们的nginx是启动起来了,但是,我们并不能访问它。容器有自己的一套虚拟系统,如:网络、文件。如果我们需要访问,则需要给容器和宿主机做一个映射,让宿主机和容器能够交互。这里,我们就给nginx增加端口和配置文件映射。我为了省事,就直接把容器中的配置文件复制出来用

1
docker cp 8dd8b3dd27aa:/etc/nginx/ ~/

接下来,我们便来建立这个映射关系

1
docker run -d --name nginx-c -v /root/nginx/:/etc/nginx/ -p 8888:80 nginx

来看看容器是否启动成功

1
2
3
4
[root@VM-12-3-centos nginx]# docker ps
CONTAINER ID   IMAGE     COMMAND                  CREATED         STATUS         PORTS                                   NAMES
5ae0319e1795   nginx     "/docker-entrypoint.…"   7 seconds ago   Up 6 seconds   0.0.0.0:8888->80/tcp, :::8888->80/tcp   nginx-c

这时候,我们便能访问我们的nginx服务,

前面已经说到,容器有自己的虚拟系统,如果需要持久化的数据不映射到宿主机上,那么当容器销毁时,数据也会随之丢失,所以,我们在用容器运行时,一定要做好数据的保存方式。

Docker常用命令

在前面,我们列出了几个常用的Docker命令,这里,我们把这几个常用命令稍微讲解一下,

docker ps

ps主要是查询正常运行的容器
docker ps 是当前正在运行的容器

1
2
3
4
[root@VM-12-3-centos nginx]# docker ps
CONTAINER ID   IMAGE     COMMAND                  CREATED             STATUS             PORTS                                   NAMES
5ae0319e1795   nginx     "/docker-entrypoint.…"   About an hour ago   Up About an hour   0.0.0.0:8888->80/tcp, :::8888->80/tcp   nginx-c

这里面的CONTAINER ID很重要,后面我们的很多操作都需要基于这个CONTAINER ID或者NAMES
docker ps -a则是列出运行中和停止中的所有容器,

docker start/stop/restart/rm [CONTAINER ID]

这几个参数这是启动/停止/重启/删除容器的参数,如:docker restart 5ae0319e1795,如果要删除容器,必须要先停止,否则会提示

1
rror response from daemon: You cannot remove a running container 5ae0319e1795f3295247e0fa14c1d19054f59578381d8367e8955f22eebdd182. Stop the container before attempting removal or force remove

docker run

docker run [OPTIONS] IMAGE [COMMAND] [ARG…],它的运行参数就比较复杂了,

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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
[root@VM-12-3-centos nginx]# docker run --help

Usage:  docker run [OPTIONS] IMAGE [COMMAND] [ARG...]

Run a command in a new container

Options:
      --add-host list                  Add a custom host-to-IP mapping (host:ip)
  -a, --attach list                    Attach to STDIN, STDOUT or STDERR
      --blkio-weight uint16            Block IO (relative weight), between 10 and 1000, or 0 to disable (default 0)
      --blkio-weight-device list       Block IO weight (relative device weight) (default [])
      --cap-add list                   Add Linux capabilities
      --cap-drop list                  Drop Linux capabilities
      --cgroup-parent string           Optional parent cgroup for the container
      --cgroupns string                Cgroup namespace to use (host|private)
                                       'host':    Run the container in the Docker host's cgroup namespace
                                       'private': Run the container in its own private cgroup namespace
                                       '':        Use the cgroup namespace as configured by the
                                                  default-cgroupns-mode option on the daemon (default)
      --cidfile string                 Write the container ID to the file
      --cpu-period int                 Limit CPU CFS (Completely Fair Scheduler) period
      --cpu-quota int                  Limit CPU CFS (Completely Fair Scheduler) quota
      --cpu-rt-period int              Limit CPU real-time period in microseconds
      --cpu-rt-runtime int             Limit CPU real-time runtime in microseconds
  -c, --cpu-shares int                 CPU shares (relative weight)
      --cpus decimal                   Number of CPUs
      --cpuset-cpus string             CPUs in which to allow execution (0-3, 0,1)
      --cpuset-mems string             MEMs in which to allow execution (0-3, 0,1)
  -d, --detach                         Run container in background and print container ID
      --detach-keys string             Override the key sequence for detaching a container
      --device list                    Add a host device to the container
      --device-cgroup-rule list        Add a rule to the cgroup allowed devices list
      --device-read-bps list           Limit read rate (bytes per second) from a device (default [])
      --device-read-iops list          Limit read rate (IO per second) from a device (default [])
      --device-write-bps list          Limit write rate (bytes per second) to a device (default [])
      --device-write-iops list         Limit write rate (IO per second) to a device (default [])
      --disable-content-trust          Skip image verification (default true)
      --dns list                       Set custom DNS servers
      --dns-option list                Set DNS options
      --dns-search list                Set custom DNS search domains
      --domainname string              Container NIS domain name
      --entrypoint string              Overwrite the default ENTRYPOINT of the image
  -e, --env list                       Set environment variables
      --env-file list                  Read in a file of environment variables
      --expose list                    Expose a port or a range of ports
      --gpus gpu-request               GPU devices to add to the container ('all' to pass all GPUs)
      --group-add list                 Add additional groups to join
      --health-cmd string              Command to run to check health
      --health-interval duration       Time between running the check (ms|s|m|h) (default 0s)
      --health-retries int             Consecutive failures needed to report unhealthy
      --health-start-period duration   Start period for the container to initialize before starting health-retries countdown (ms|s|m|h) (default 0s)
      --health-timeout duration        Maximum time to allow one check to run (ms|s|m|h) (default 0s)
      --help                           Print usage
  -h, --hostname string                Container host name
      --init                           Run an init inside the container that forwards signals and reaps processes
  -i, --interactive                    Keep STDIN open even if not attached
      --ip string                      IPv4 address (e.g., 172.30.100.104)
      --ip6 string                     IPv6 address (e.g., 2001:db8::33)
      --ipc string                     IPC mode to use
      --isolation string               Container isolation technology
      --kernel-memory bytes            Kernel memory limit
  -l, --label list                     Set meta data on a container
      --label-file list                Read in a line delimited file of labels
      --link list                      Add link to another container
      --link-local-ip list             Container IPv4/IPv6 link-local addresses
      --log-driver string              Logging driver for the container
      --log-opt list                   Log driver options
      --mac-address string             Container MAC address (e.g., 92:d0:c6:0a:29:33)
  -m, --memory bytes                   Memory limit
      --memory-reservation bytes       Memory soft limit
      --memory-swap bytes              Swap limit equal to memory plus swap: '-1' to enable unlimited swap
      --memory-swappiness int          Tune container memory swappiness (0 to 100) (default -1)
      --mount mount                    Attach a filesystem mount to the container
      --name string                    Assign a name to the container
      --network network                Connect a container to a network
      --network-alias list             Add network-scoped alias for the container
      --no-healthcheck                 Disable any container-specified HEALTHCHECK
      --oom-kill-disable               Disable OOM Killer
      --oom-score-adj int              Tune host's OOM preferences (-1000 to 1000)
      --pid string                     PID namespace to use
      --pids-limit int                 Tune container pids limit (set -1 for unlimited)
      --platform string                Set platform if server is multi-platform capable
      --privileged                     Give extended privileges to this container
  -p, --publish list                   Publish a container's port(s) to the host
  -P, --publish-all                    Publish all exposed ports to random ports
      --pull string                    Pull image before running ("always"|"missing"|"never") (default "missing")
      --read-only                      Mount the container's root filesystem as read only
      --restart string                 Restart policy to apply when a container exits (default "no")
      --rm                             Automatically remove the container when it exits
      --runtime string                 Runtime to use for this container
      --security-opt list              Security Options
      --shm-size bytes                 Size of /dev/shm
      --sig-proxy                      Proxy received signals to the process (default true)
      --stop-signal string             Signal to stop a container (default "SIGTERM")
      --stop-timeout int               Timeout (in seconds) to stop a container
      --storage-opt list               Storage driver options for the container
      --sysctl map                     Sysctl options (default map[])
      --tmpfs list                     Mount a tmpfs directory
  -t, --tty                            Allocate a pseudo-TTY
      --ulimit ulimit                  Ulimit options (default [])
  -u, --user string                    Username or UID (format: <name|uid>[:<group|gid>])
      --userns string                  User namespace to use
      --uts string                     UTS namespace to use
  -v, --volume list                    Bind mount a volume
      --volume-driver string           Optional volume driver for the container
      --volumes-from list              Mount volumes from the specified container(s)
  -w, --workdir string                 Working directory inside the container

这里还是只介绍几个常用的命令参数吧,

  • -d: 后台运行容器
  • -P: 容器内部端口随机映射到主机的端口
  • -p: 指定端口映射
  • –name: 指定一个容器的名称
  • –cpuset: 指定CPU运行
  • -m(–memory): 设置容器内存最大值(单位可以为 b,k,M,g;最小为4M),除了内存限制,还可以设置内存+交换分区大小(–memory-swap)
  • –link=[]: 链接到另一个容器
  • -v(–volume): 指定容器与宿主机的映射目录

运行示例docker run -d --name nginx-cc -v /root/nginx/:/etc/nginx/ -p 9999:80 -m 256M nginx

docker cp

cp命令主要是用于宿主机和容器间的文件复制,一般格式如下:
docker cp [OPTIONS] 容器名/容器Id:容器文件路径 宿主机文件路径 从容器复制到宿主机
docker cp [OPTIONS] 宿主机文件路径 容器名/容器Id:容器文件路径 从宿主机复制到容器中

docker inspect

inspect主要是查看容器或者镜像元数据,如:

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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
[root@VM-12-3-centos nginx]# docker inspect cd1309c02a5e
[
    {
        "Id": "cd1309c02a5efc9855b0987e6dba44c6b858162f14dc7fbae4138b1ca4361dae",
        "Created": "2021-12-28T05:54:50.381961654Z",
        "Path": "/docker-entrypoint.sh",
        "Args": [
            "nginx",
            "-g",
            "daemon off;"
        ],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 3172754,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2021-12-28T05:54:50.720774527Z",
            "FinishedAt": "0001-01-01T00:00:00Z"
        },
        "Image": "sha256:f6987c8d6ed59543e9f34327c23e12141c9bad1916421278d720047ccc8e1bee",
        "ResolvConfPath": "/var/lib/docker/containers/cd1309c02a5efc9855b0987e6dba44c6b858162f14dc7fbae4138b1ca4361dae/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/cd1309c02a5efc9855b0987e6dba44c6b858162f14dc7fbae4138b1ca4361dae/hostname",
        "HostsPath": "/var/lib/docker/containers/cd1309c02a5efc9855b0987e6dba44c6b858162f14dc7fbae4138b1ca4361dae/hosts",
        "LogPath": "/var/lib/docker/containers/cd1309c02a5efc9855b0987e6dba44c6b858162f14dc7fbae4138b1ca4361dae/cd1309c02a5efc9855b0987e6dba44c6b858162f14dc7fbae4138b1ca4361dae-json.log",
        "Name": "/nginx-cc",
        "RestartCount": 0,
        "Driver": "overlay2",
        "Platform": "linux",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": [
                "/root/nginx/:/etc/nginx/"
            ],
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "NetworkMode": "default",
            "PortBindings": {
                "80/tcp": [
                    {
                        "HostIp": "",
                        "HostPort": "9999"
                    }
                ]
            },
            "RestartPolicy": {
                "Name": "no",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": null,
            "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",
            "ConsoleSize": [
                0,
                0
            ],
            "Isolation": "",
            "CpuShares": 0,
            "Memory": 268435456,
            "NanoCpus": 0,
            "CgroupParent": "",
            "BlkioWeight": 0,
            "BlkioWeightDevice": [],
            "BlkioDeviceReadBps": null,
            "BlkioDeviceWriteBps": null,
            "BlkioDeviceReadIOps": null,
            "BlkioDeviceWriteIOps": null,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpuRealtimePeriod": 0,
            "CpuRealtimeRuntime": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "Devices": [],
            "DeviceCgroupRules": null,
            "DeviceRequests": null,
            "KernelMemory": 0,
            "KernelMemoryTCP": 0,
            "MemoryReservation": 0,
            "MemorySwap": 536870912,
            "MemorySwappiness": null,
            "OomKillDisable": false,
            "PidsLimit": null,
            "Ulimits": null,
            "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"
            ],
            "ReadonlyPaths": [
                "/proc/bus",
                "/proc/fs",
                "/proc/irq",
                "/proc/sys",
                "/proc/sysrq-trigger"
            ]
        },
        "GraphDriver": {
            "Data": {
                "LowerDir": "/var/lib/docker/overlay2/8731f576cc3fb7511f9f9761e58d8480e2e6249889119962b9d0809e2105310b-init/diff:/var/lib/docker/overlay2/618f7e094534925da63be88e1409cf0020cc0b6561b266fafca8df4d77c07cf3/diff:/var/lib/docker/overlay2/05f6ffd411a6ec713698611d0a3732d55c7d6bf13105c736492734f1c32965cb/diff:/var/lib/docker/overlay2/47646e0e9a17db5299cbd0cbdc8a7ac300be03ed728f60fb331b6c236680859a/diff:/var/lib/docker/overlay2/fd51e460d7679d64ac84fed908c691f98ab6bcce6cddfaa947ace1071f541a52/diff:/var/lib/docker/overlay2/bebc9613df0154882c65ba436f084e864152fb77b9ff25f796d5f56bf8af7ff1/diff:/var/lib/docker/overlay2/5291486555a45b2adddeb8dbf77548c892f222b96c93208ccc87180025fb2a05/diff",
                "MergedDir": "/var/lib/docker/overlay2/8731f576cc3fb7511f9f9761e58d8480e2e6249889119962b9d0809e2105310b/merged",
                "UpperDir": "/var/lib/docker/overlay2/8731f576cc3fb7511f9f9761e58d8480e2e6249889119962b9d0809e2105310b/diff",
                "WorkDir": "/var/lib/docker/overlay2/8731f576cc3fb7511f9f9761e58d8480e2e6249889119962b9d0809e2105310b/work"
            },
            "Name": "overlay2"
        },
        "Mounts": [
            {
                "Type": "bind",
                "Source": "/root/nginx",
                "Destination": "/etc/nginx",
                "Mode": "",
                "RW": true,
                "Propagation": "rprivate"
            }
        ],
        "Config": {
            "Hostname": "cd1309c02a5e",
            "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.4",
                "NJS_VERSION=0.7.0",
                "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": "f8caff2c6de91132584c5f577d8fa7a695d718a8fe91913842f8120a1fd755b2",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {
                "80/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "9999"
                    },
                    {
                        "HostIp": "::",
                        "HostPort": "9999"
                    }
                ]
            },
            "SandboxKey": "/var/run/docker/netns/f8caff2c6de9",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "1840b9975ae073a167161b927ba9b5cbd5f523afc1deba41b935de41ed254025",
            "Gateway": "172.17.0.1",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "172.17.0.3",
            "IPPrefixLen": 16,
            "IPv6Gateway": "",
            "MacAddress": "02:42:ac:11:00:03",
            "Networks": {
                "bridge": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": null,
                    "NetworkID": "fed3528a99f04939a651d8b67872ec51e7b99dff8338726598e3ce0300ae7c93",
                    "EndpointID": "1840b9975ae073a167161b927ba9b5cbd5f523afc1deba41b935de41ed254025",
                    "Gateway": "172.17.0.1",
                    "IPAddress": "172.17.0.3",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "02:42:ac:11:00:03",
                    "DriverOpts": null
                }
            }
        }
    }
]

从返回的信息中,我们可以得到,启动时所设置的启动参数。如:

1
2
3
4
5
6
7
8
9
10
11
 "PortBindings": {
                "80/tcp": [
                    {
                        "HostIp": "",
                        "HostPort": "9999"
                    }
                ]
            },
"Binds": [
                "/root/nginx/:/etc/nginx/"
            ]

如果,那天我们忘记之前容器启动的参数时,便可以通过inspect来帮我们找回来。

docker logs

logs主要是查询docker容器的运行日志,如:

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
[root@VM-12-3-centos ~]# docker logs 5ae0319e1795
/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: IPv6 listen already enabled
/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
2021/12/28 03:59:20 [notice] 1#1: using the "epoll" event method
2021/12/28 03:59:20 [notice] 1#1: nginx/1.21.4
2021/12/28 03:59:20 [notice] 1#1: built by gcc 10.2.1 20210110 (Debian 10.2.1-6)
2021/12/28 03:59:20 [notice] 1#1: OS: Linux 4.18.0-305.3.1.el8.x86_64
2021/12/28 03:59:20 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2021/12/28 03:59:20 [notice] 1#1: start worker processes
2021/12/28 03:59:20 [notice] 1#1: start worker process 24
2021/12/28 03:59:20 [notice] 1#1: start worker process 25
172.17.0.1 - - [28/Dec/2021:03:59:36 +0000] "GET / HTTP/1.1" 200 615 "-" "curl/7.61.1" "-"
2021/12/28 05:09:38 [notice] 1#1: signal 3 (SIGQUIT) received, shutting down
2021/12/28 05:09:38 [notice] 25#25: gracefully shutting down
2021/12/28 05:09:38 [notice] 25#25: exiting
2021/12/28 05:09:38 [notice] 25#25: exit
2021/12/28 05:09:38 [notice] 24#24: gracefully shutting down
2021/12/28 05:09:38 [notice] 24#24: exiting
2021/12/28 05:09:38 [notice] 24#24: exit
2021/12/28 05:09:38 [notice] 1#1: signal 17 (SIGCHLD) received from 24
2021/12/28 05:09:38 [notice] 1#1: worker process 24 exited with code 0
2021/12/28 05:09:38 [notice] 1#1: signal 29 (SIGIO) received
2021/12/28 05:09:38 [notice] 1#1: signal 17 (SIGCHLD) received from 25
2021/12/28 05:09:38 [notice] 1#1: worker process 25 exited with code 0
2021/12/28 05:09:38 [notice] 1#1: exit
/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: IPv6 listen already enabled
/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
2021/12/28 05:09:38 [notice] 1#1: using the "epoll" event method
2021/12/28 05:09:38 [notice] 1#1: nginx/1.21.4
2021/12/28 05:09:38 [notice] 1#1: built by gcc 10.2.1 20210110 (Debian 10.2.1-6)
2021/12/28 05:09:38 [notice] 1#1: OS: Linux 4.18.0-305.3.1.el8.x86_64
2021/12/28 05:09:38 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2021/12/28 05:09:38 [notice] 1#1: start worker processes
2021/12/28 05:09:38 [notice] 1#1: start worker process 24
2021/12/28 05:09:38 [notice] 1#1: start worker process 25

相关推荐

为何越来越多的编程语言使用JSON(为什么编程)

JSON是JavascriptObjectNotation的缩写,意思是Javascript对象表示法,是一种易于人类阅读和对编程友好的文本数据传递方法,是JavaScript语言规范定义的一个子...

何时在数据库中使用 JSON(数据库用json格式存储)

在本文中,您将了解何时应考虑将JSON数据类型添加到表中以及何时应避免使用它们。每天?分享?最新?软件?开发?,Devops,敏捷?,测试?以及?项目?管理?最新?,最热门?的?文章?,每天?花?...

MySQL 从零开始:05 数据类型(mysql数据类型有哪些,并举例)

前面的讲解中已经接触到了表的创建,表的创建是对字段的声明,比如:上述语句声明了字段的名称、类型、所占空间、默认值和是否可以为空等信息。其中的int、varchar、char和decimal都...

JSON对象花样进阶(json格式对象)

一、引言在现代Web开发中,JSON(JavaScriptObjectNotation)已经成为数据交换的标准格式。无论是从前端向后端发送数据,还是从后端接收数据,JSON都是不可或缺的一部分。...

深入理解 JSON 和 Form-data(json和formdata提交区别)

在讨论现代网络开发与API设计的语境下,理解客户端和服务器间如何有效且可靠地交换数据变得尤为关键。这里,特别值得关注的是两种主流数据格式:...

JSON 语法(json 语法 priority)

JSON语法是JavaScript语法的子集。JSON语法规则JSON语法是JavaScript对象表示法语法的子集。数据在名称/值对中数据由逗号分隔花括号保存对象方括号保存数组JS...

JSON语法详解(json的语法规则)

JSON语法规则JSON语法是JavaScript对象表示法语法的子集。数据在名称/值对中数据由逗号分隔大括号保存对象中括号保存数组注意:json的key是字符串,且必须是双引号,不能是单引号...

MySQL JSON数据类型操作(mysql的json)

概述mysql自5.7.8版本开始,就支持了json结构的数据存储和查询,这表明了mysql也在不断的学习和增加nosql数据库的有点。但mysql毕竟是关系型数据库,在处理json这种非结构化的数据...

JSON的数据模式(json数据格式示例)

像XML模式一样,JSON数据格式也有Schema,这是一个基于JSON格式的规范。JSON模式也以JSON格式编写。它用于验证JSON数据。JSON模式示例以下代码显示了基本的JSON模式。{"...

前端学习——JSON格式详解(后端json格式)

JSON(JavaScriptObjectNotation)是一种轻量级的数据交换格式。易于人阅读和编写。同时也易于机器解析和生成。它基于JavaScriptProgrammingLa...

什么是 JSON:详解 JSON 及其优势(什么叫json)

现在程序员还有谁不知道JSON吗?无论对于前端还是后端,JSON都是一种常见的数据格式。那么JSON到底是什么呢?JSON的定义...

PostgreSQL JSON 类型:处理结构化数据

PostgreSQL提供JSON类型,以存储结构化数据。JSON是一种开放的数据格式,可用于存储各种类型的值。什么是JSON类型?JSON类型表示JSON(JavaScriptO...

JavaScript:JSON、三种包装类(javascript 包)

JOSN:我们希望可以将一个对象在不同的语言中进行传递,以达到通信的目的,最佳方式就是将一个对象转换为字符串的形式JSON(JavaScriptObjectNotation)-JS的对象表示法...

Python数据分析 只要1分钟 教你玩转JSON 全程干货

Json简介:Json,全名JavaScriptObjectNotation,JSON(JavaScriptObjectNotation(记号、标记))是一种轻量级的数据交换格式。它基于J...

比较一下JSON与XML两种数据格式?(json和xml哪个好)

JSON(JavaScriptObjectNotation)和XML(eXtensibleMarkupLanguage)是在日常开发中比较常用的两种数据格式,它们主要的作用就是用来进行数据的传...

取消回复欢迎 发表评论:

请填写验证码