首页 > 解决方案 > Docker-compose 在运行数小时后崩溃

问题描述

我有一个在 ec2 实例上的 docker 容器中运行的 springBoot 应用程序。我运行了好几个月,但几天后(我只改变了应用程序中的小东西)。Docker崩溃,当我尝试重新启动时

docker-compose up -d

我收到此错误:

ERROR: Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?

If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.

我检查了那里的权限都很好。我不需要 sudo。

如果当然我可以再次启动 docker 服务。然后运行 ​​docker-compose。..但几个小时后它再次发生。任何人都有任何想法或如何调试 ist。

[ec2-user@ip-xxxx-xxx6 docker]$ docker info
Containers: 2
 Running: 2
 Paused: 0
 Stopped: 0
Images: 8
Server Version: 18.09.9-ce
Storage Driver: overlay2
 Backing Filesystem: xfs
 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: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
runc version: 2b18fe1d885ee5083ef9f0838fee39b62d653e30
init version: fec3683
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.14.171-136.231.amzn2.x86_64
Operating System: Amazon Linux 2
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 983.4MiB
Name: ip-xxxxxxxx.eu-central-1.compute.internal
ID: BCL7:57U4:NUOW:UEW3:XQDK:TWMA:QKWL:GCMA:IFVH:JHCU:XE6S:JGZN
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

标签: spring-bootdockeramazon-ec2docker-compose

解决方案


似乎您在后台的 docker 守护程序停止工作。这可能与您的应用程序或安装有关。

对于第二个,您可以尝试设置一个新的/不同的 ec2 主机,看看它是否再次发生。

首先,我会检查您正在运行的 docker 容器,看看您需要更改主机上的一些配置以使其以稳定的方式运行。


推荐阅读