[英]Docker container is running, but its process has finished
I run my typescript application in a docker container.我在 docker 容器中运行我的打字稿应用程序。 Sometimes it happens, that the application finishes, but the container is still in the running state.
有时会发生,应用程序完成,但容器仍处于运行状态。 How is this even possible ?
这怎么可能? I was thinking that I forgot to catch a rejected Promise or forgot to close a stream, but in that case,
docker top myContainer
would say me, that the main process is still running, right ?我在想我忘记捕获被拒绝的 Promise 或忘记关闭流,但在这种情况下,
docker top myContainer
会说我,主进程仍在运行,对吧?
Docker ps:码头工人:
docker ps
5c63b442af79 filipxxx/v2x_communication "npm run start ether…" 2 hours ago Up 2 hours vehicle2
Docker top:码头工人顶部:
docker top vehicle2
UID PID PPID C STIME
Docker inspect:码头工人检查:
docker inspect vehicle2
[
{
"Id": "5c63b442af799b8ff3b83d7c53e1ccfd2a290d469b58b10970217aa987e963f9",
"Created": "2019-01-03T13:26:50.947651153Z",
"Path": "npm",
"Args": [
"run",
"start",
"ethereum",
"172.21.0.3:8545",
"run-producer",
"2",
"100",
"0xfb69fd63952d243fc235b91ff7bc49f9cd4a31f8"
],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 46799,
"ExitCode": 0,
"Error": "",
"StartedAt": "2019-01-03T13:33:52.860979672Z",
"FinishedAt": "0001-01-01T00:00:00Z"
},
...
Surprisingly when running docker exec -i vehicle2 echo 'hello world'
, it returns me: cannot exec in a stopped state: unknown
.令人惊讶的是,当运行
docker exec -i vehicle2 echo 'hello world'
,它返回我: cannot exec in a stopped state: unknown
。
Below is the dockerfile, I used to build the image.下面是dockerfile,我用来构建镜像。
FROM node:8
WORKDIR /v2x_communication
COPY . /v2x_communication
RUN npm install && npm run build
ENTRYPOINT ["npm", "run"]
Even if I run docker stop vehicle2, it exits successfully, but the vehicle2 is still listed under docker ps
and docker inspect vehicle2
is still saying that its in the running state.即使我运行 docker stop vehicle2 ,它也成功退出,但是 docker
docker ps
下仍然列出了 Vehicle2 并且docker inspect vehicle2
仍然说它处于运行状态。
Docker info:码头工人信息:
Containers: 50
Running: 48
Paused: 0
Stopped: 2
Images: 150
Server Version: 18.09.0
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: active
NodeID: sah8xlcjnxbq13uofznqrjs6e
Is Manager: false
Node Address: 10.132.0.5
Manager Addresses:
10.132.0.2:2377
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: c4446665cb9c30056f4998ed953e6d4ff22c7c39
runc version: 4fc53a81fb7c994640722ac585fa9ca548971871
init version: fec3683
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 4.15.0-1026-gcp
Operating System: Ubuntu 18.04.1 LTS
OSType: linux
Architecture: x86_64
CPUs: 48
Total Memory: 94.41GiB
Name: vehicle-fleet-big-1
ID: OAVG:6QVR:EH3F:OYNO:ADC4:QDAN:R2AF:LSSV:2VSI:IJWJ:PJH2:LJVP
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine
WARNING: No swap limit support
Either you've found a bug, or something is holding the container open.要么你发现了一个错误,要么是有什么东西使容器保持打开状态。 The closest issue I can find is rather old #30927 .
我能找到的最接近的问题是相当古老的#30927 。 I'd start investigating dockerd and OS logs to see if there are any errors you can find there.
我将开始调查 dockerd 和 OS 日志,以查看您是否可以在其中找到任何错误。 For dockerd, that's in
journalctl -u docker
for systemd environments.对于 dockerd,这在用于 systemd 环境的
journalctl -u docker
。 And on the OS, anything under /var/log for would be good to start debugging.在操作系统上,/var/log for 下的任何内容都可以很好地开始调试。 Potential blockers I can imagine include:
我可以想象的潜在阻滞剂包括:
If you can't find anything, an issue in the moby/moby repo may be appropriate, but without any logs of an error pointing back to why, or a way to reproduce, it will be difficult to fix.如果您找不到任何东西,则 moby/moby 存储库中的问题可能是合适的,但是如果没有任何错误日志指出原因或重现方法,则很难修复。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.