When I tried to run a Docker command in Visual Studio Code’s terminal, I encountered the “Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get “http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/json”: dial unix /var/run/docker.sock: connect: permission denied” error.
![](https://www.nucleiotechnologies.com/wp-content/uploads/2022/06/Screenshot-from-2022-06-28-16-53-54.png)
I can’t also use the command “docker-compose up” to start and run an entire app on a standalone host that contains multiple services like DB.
Therefore, this is a fix for the issue. All you need to do is type the codes below into your VS Code prompt.
sudo chmod 666 /var/run/docker.sock
sudo setfacl --modify user::rw /var/run/docker.sock
![](https://www.nucleiotechnologies.com/wp-content/uploads/2022/06/289626877_1158163314744939_2173088255909549146_n-1024x47.png)
After that, you can verify whether Docker commands now function.
![](https://www.nucleiotechnologies.com/wp-content/uploads/2022/06/290380404_577227337306669_7149679839388311633_n-1024x454.png)
I hope this was helpful. Thank you very much!