Docker + maven build problem — unix://localhost:80: Permission denied

使用docker-maven-plugin进行构建镜像报错如下:

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

解决方案 :

Add the docker group if it doesn’t already exist:

sudo groupadd docker  #增加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 jenkins  #将jenkins用户添加到docker组

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  #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
posted @ 2024-05-31 15:32  烟雨浮华  阅读(80)  评论(0编辑  收藏  举报