vic
vic

Reputation: 2818

Unable to run docker-compose

Following this article on Jhipster, I build the project. I, however, can't run docker-compose. So, I try to figure out the problem. I walk step by step with this Docker-Compose article without luck.

$ sudo service docker status
docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2018-12-27 15:40:22 PST; 2 days ago
Docs: https://docs.docker.com
Main PID: 1960 (dockerd)
Tasks: 20 (limit: 4440)
Memory: 68.2M
CGroup: /system.slice/docker.service
       ├─1960 /usr/bin/dockerd -H fd://
       └─2093 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 --start-timeout 2m --s

Dec 27 15:40:10 tk-PC dockerd[1960]: time="2018-12-27T15:40:10.493340278-08:00" level=warning msg="Your kernel does not support swap memory li
Dec 27 15:40:10 tk-PC dockerd[1960]: time="2018-12-27T15:40:10.493612101-08:00" level=warning msg="Your kernel does not support cgroup rt peri
Dec 27 15:40:10 tk-PC dockerd[1960]: time="2018-12-27T15:40:10.493681034-08:00" level=warning msg="Your kernel does not support cgroup rt runt
Dec 27 15:40:10 tk-PC dockerd[1960]: time="2018-12-27T15:40:10.496381656-08:00" level=info msg="Loading containers: start."
Dec 27 15:40:17 tk-PC dockerd[1960]: time="2018-12-27T15:40:17.498415923-08:00" level=info msg="Default bridge (docker0) is assigned with an I
Dec 27 15:40:19 tk-PC dockerd[1960]: time="2018-12-27T15:40:19.646853084-08:00" level=info msg="Loading containers: done."
Dec 27 15:40:22 tk-PC dockerd[1960]: time="2018-12-27T15:40:22.512083092-08:00" level=info msg="Daemon has completed initialization"
Dec 27 15:40:22 tk-PC dockerd[1960]: time="2018-12-27T15:40:22.512266914-08:00" level=info msg="Docker daemon" commit=89658be graphdriver=aufs
Dec 27 15:40:22 tk-PC dockerd[1960]: time="2018-12-27T15:40:22.553322342-08:00" level=info msg="API listen on /var/run/docker.sock"
Dec 27 15:40:22 tk-PC systemd[1]: Started Docker Application Container Engine.

$ sudo ls -la /var/run/docker.sock
srw-rw---- 1 root docker 0 Dec 27 15:39 /var/run/docker.sock

$ sudo usermod -aG docker ${USER}

$ docker-compose -f docker-compose.yml build --build-arg UID=$(id -u)
ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running?

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

The result of the last step is the same as "docker-compose up -d". According to the article, it would be a permission problem if the problem still exists at this point. How can I find what permission issue?

Upvotes: 1

Views: 642

Answers (1)

Anlis
Anlis

Reputation: 839

There are multiple ways you can solve this problem. Firstly try to export environment variable of docker host with command:

export DOCKER_HOST=/var/run/docker.sock

If it works you can add the same line to your bashrc config to save this export permanently.

If it doesn't work you can try to modify docker daemon config. It located in

/etc/docker/daemon.json

You'll need to append the localhost to your hosts like that:

"hosts": ["old_hosts_not_modified_only_append_new_one", "tcp://localhost:2376"],

and restart docker daemon using command:

service docker restart

Hope it gonna help ya

Upvotes: 1

Related Questions