Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Couldn't connect to Docker daemon at http+docker://localhost with docker-compose

I have this React app that I want to run on an Apache HTTP Docker container.

So I created a Dockerfile that works with sudo docker build and sudo docker run <name>

FROM httpd:2.4
COPY ./dist/ /usr/local/apache2/htdocs/

I created a docker-compose.yml

version: '3'
services:
  frontend:
    build: .
    ports:
     - "8080:80"
    container_name: frontend

But when I run sudo docker-compose build I get this error:

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.

What is the problem?

like image 242
Victor Ferreira Avatar asked Jun 22 '18 01:06

Victor Ferreira


People also ask

How do I fix Permission denied while trying to connect to the Docker daemon socket at Unix?

Fix 1: Run all the docker commands with sudo If you have sudo access on your system, you may run each docker command with sudo and you won't see this 'Got permission denied while trying to connect to the Docker daemon socket' anymore.


1 Answers

run with sudo:

sudo docker-compose up -d

like image 156
max3d Avatar answered Sep 28 '22 11:09

max3d