docker-撰写错误“无法连接到Docker”

时间:2019-10-06 08:57:03

标签: docker docker-compose

开始学习docker / docker-compose,经过一些教程之后,我认为我找到了一个不错的教程。

https://github.com/sprintcube/docker-compose-lamp/tree/master/config/php

在安装并准备好之后,我做了:

sudo service docker start

docker-compose up -d

但失败,并显示以下消息:

dev@terra-dev:~/Projekte/docker-compose-lamp$ 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.

我必须在哪里定义Docker主机?在我的docker-compose文件中?还是其他地方?

关于n00n

更新:sudo服务docker状态的结果:

docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; disabled; vendor preset: enabled)
   Active: active (running) since Sun 2019-10-06 13:25:25 CEST; 9s ago
     Docs: https://docs.docker.com
 Main PID: 2640 (dockerd)
    Tasks: 14
   CGroup: /system.slice/docker.service
           └─2640 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Okt 06 13:25:24 terra-dev dockerd[2640]: time="2019-10-06T13:25:24.087358085+02:00" level=warning msg="Your kernel does not support cgroup rt period"
Okt 06 13:25:24 terra-dev dockerd[2640]: time="2019-10-06T13:25:24.087381826+02:00" level=warning msg="Your kernel does not support cgroup rt runtime"
Okt 06 13:25:24 terra-dev dockerd[2640]: time="2019-10-06T13:25:24.092676335+02:00" level=info msg="Loading containers: start."
Okt 06 13:25:24 terra-dev dockerd[2640]: time="2019-10-06T13:25:24.732654311+02:00" level=info msg="Default bridge (docker0) is assigned with an IP address 17
Okt 06 13:25:24 terra-dev dockerd[2640]: time="2019-10-06T13:25:24.959702995+02:00" level=info msg="Loading containers: done."
Okt 06 13:25:25 terra-dev dockerd[2640]: time="2019-10-06T13:25:25.020225493+02:00" level=warning msg="failed to retrieve runc version: unknown output format:
Okt 06 13:25:25 terra-dev dockerd[2640]: time="2019-10-06T13:25:25.096346086+02:00" level=info msg="Docker daemon" commit=2d0083d graphdriver(s)=overlay2 vers
Okt 06 13:25:25 terra-dev dockerd[2640]: time="2019-10-06T13:25:25.103672560+02:00" level=info msg="Daemon has completed initialization"
Okt 06 13:25:25 terra-dev dockerd[2640]: time="2019-10-06T13:25:25.148505614+02:00" level=info msg="API listen on /var/run/docker.sock"
Okt 06 13:25:25 terra-dev systemd[1]: Started Docker Application Container Engine.

1 个答案:

答案 0 :(得分:0)

似乎您无法连接到docker daemon。您未使用正确的权限,或者Docker守护进程实际上已关闭。

使用以下命令:

sudo docker-compose up -d    If docker daemon is already running.