1.执行 docker build --no-cache --force-rm -t registry.thunisoft.com:5000/artery/zxzbtx .
报错:
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.29/build?buildargs=%7B%7D&cachefrom=%5B%5D&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile&forcerm=1&labels=%7B%7D&memory=0&memswap=0&networkmode=default&nocache=1&rm=1&shmsize=0&t=registry.thunisoft.com%3A5000%2Fartery%2Fzxzbtx%3Alatest&target=&ulimits=null: dial unix /var/run/docker.sock: connect: permission denied
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.29/images/registry.thunisoft.com:5000/artery/zxzbtx/push?tag=latest: dial unix /var/run/docker.sock: connect: permission denied
原因:gitlab-runner执行时 是以 gitlab-runner用户来执行的 该用户不属于docker group 需将该用户加入该组
解决:
首先查询 是否有该用户 cut -d : -f 1 /etc/passwd
然后查询 是否存在docker组
sudo groupadd docker
然后执行 将gitlab-runner加入docker组
sudo gpasswd -a gitlab-runner docker
问题解决。
2.执行
docker build --no-cache --force-rm -t registry.thunisoft.com:5000/artery/zxzbtx .
报错:
http: server gave HTTP response to HTTPS client
原因:这个问题是由于客户端采用https,docker registry未采用https服务所致。
解决:在”/etc/docker/“目录下,创建”daemon.json“文件。在文件中写入:
{ "insecure-registries":["registry.thunisoft.com:5000"] }
然后重启docker服务