Cli: Docker-compose Error When Trying to Run `docker-compose up -d`: Unable to Connect to Docker Daemon

Created on 17 Aug 2018  路  2Comments  路  Source: docker/cli


BUG REPORT INFORMATION

Use the commands below to provide key information from your environment:
You do NOT have to include this information if this is a FEATURE REQUEST
-->

Description

I am trying to setup docker and docker-compose for a repository that I have been working on in Mac and I moved to Ubuntu 16.04. I followed the installation instructions for my computer at https://docs.docker.com/install/linux/docker-ce/ubuntu/. I am running docker in an Ubuntu 16.04 VM using Virtual Box.
Docker version 18.06.0-ce, build 0ffa825
docker-compose version 1.18.0, build 8dd22a9

Upon installing docker I went to my repository and tried to run docker-compose up -d and I received the following output:

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.

So, I ran export DOCKER_HOST=127.0.0.1:2375 which is what was suggested on https://github.com/docker/compose/issues/4181. I then got

ERROR: Couldn't connect to Docker daemon at http://127.0.0.1:2375 - is it running?

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

Steps to reproduce the issue:

  1. Install docker for ubuntu from https://docs.docker.com/install/linux/docker-ce/ubuntu/
  2. Try to run docker-compose up -d on any multi-service docker-compose file.

Describe the results you expected:
I expected to see docker-compose start up all the docker images in my docker-compose.yml file.

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker version:

Client:
 Version:           18.06.0-ce
 API version:       1.38
 Go version:        go1.10.3
 Git commit:        0ffa825
 Built:             Wed Jul 18 19:11:02 2018
 OS/Arch:           linux/amd64
 Experimental:      false
Cannot connect to the Docker daemon at tcp://127.0.0.1:2375. Is the docker daemon running?

Output of docker info:

Cannot connect to the Docker daemon at tcp://127.0.0.1:2375. Is the docker daemon running?

Most helpful comment

I was getting the same error (Couldn't connect to Docker daemon at http+docker://localunixsocket) when trying to run commands on an EC2 instance on AWS.

After trying a number of suggestions, I inadvertently ran a docker-compose command with sudo, and it worked. So running all commands with sudo resolved all my issues..go figure.

All 2 comments

The issue was with some installation of docker-compose. After wiping it clean and trying again, it started working.

I was getting the same error (Couldn't connect to Docker daemon at http+docker://localunixsocket) when trying to run commands on an EC2 instance on AWS.

After trying a number of suggestions, I inadvertently ran a docker-compose command with sudo, and it worked. So running all commands with sudo resolved all my issues..go figure.

Was this page helpful?
0 / 5 - 0 ratings