Docker + maven build problem — unix://localhost:80: Permission denied
1 min readFeb 15, 2021
Error Description :
- This is a Wso2 Micro Integrator (MI) project that I set up using integration studio and I’m following the documentation at https://spring.io/guides/gs/spring-boot-docker/#_build_a_docker_image_with_maven
- Trying to build the project and the maven plugin fails with “{}->unix://localhost:80: Permission denied”.
- Set up the project as per the above documentation and following was the error that occurred during the initial build.
com.spotify.docker.client.shaded.org.apache.http.impl.execchain.RetryExec execute INFO: I/O exception (java.io.IOException) caught when processing request to {}->unix://localhost:80: Permission denied
Error resolution :
- Add the docker group if it doesn’t already exist:
sudo groupadd docker
- Add the connected user “$USER” to the docker group. Change the user name to match your preferred user if you do not want to use your current user:
sudo usermod -aG docker $USER
- Provide the /var/run/docker.sock socket and /var/run/docker directory the proper permissions to make it work:
sudo chown root:docker /var/run/docker.sock
sudo chown -R root:docker /var/run/docker
- If the above commands do not resolve your issue try to run the below command from root:
chmod 666 /var/run/docker.sock
It will allow users to have permission to Docker socket file.