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?
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.
run with sudo:
sudo docker-compose up -d
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With