Cannot connect to the Docker daemon. Is the docker daemon running on this host?
When Jenkins is configured to automatically build dockerfiles from gitlab and upload them to harbor, the above problems are encountered. When Jenkins executes the docker command, the above errors will be reported. After consulting relevant data, it is found that the solutions are as follows:
I Modify docker service configuration
systemctl stop docker
sudo gpasswd - a Jenkins docker
# add Jenkins users to the docker group
VIM/usr/lib/SYSTEMd/system/docker. Service
#ExecStart=/usr/bin/dockerd-current \
# --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current \
# --default-runtime=docker-runc \
# --exec-opt native.cgroupdriver=systemd \
# --userland-proxy-path=/usr/libexec/docker/docker-proxy-current \
# $OPTIONS \
# $DOCKER_STORAGE_OPTIONS \
# $DOCKER_NETWORK_OPTIONS \
# $ADD_REGISTRY \
# $BLOCK_REGISTRY \
# $INSECURE_REGISTRY\
# $REGISTRIES
ExecStart=/usr/bin/docker daemon -H unix:// -H tcp://192.168.1.1:2375
#Replace the above commented configuration file with the newly added file below.
systemctl daemon reload
systemctl restart docker
2. Restart the Jenkins service, build the current project, and check whether the relevant docker commands can be executed
systemctl restart Jenkins
If you encounter the problem that the filtering Jenkins process shows that the current service has been closed, but Jenkins still cannot be started, you can execute the java - jar Jenkins. War
command to see the detailed error messages. What’s more wonderful is that I have closed the Jenkins process, the filtering service and port have been closed, but the address occupied error will still be reported when starting the Jenkins service, At this point, re execute the systemctl stop Jenkins
command, and then start the Jenkins service to see if it can be solved
Similar Posts:
- [Solved] Docker Starup Error: Failed to start Docker Application Container Engine.
- Harbor 443 connect connection refused [How to Solve]
- Docker Cannot Start: Failed to start Docker Application Container Engine
- Docker login harbor 403 Forbidden [How to Solve]
- How to Solve error: docker-runc not installed on system
- Docker ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? [How to Solve]
- [Solved] http: server gave HTTP response to HTTPS client
- docker pull Error: Get https://hub.xxx.com/v1/_ping: dial tcp 192.168.1.8:443: getsockopt: connection refused
- [Solved] Failed to start Docker Application Container Engine.
- [Solved] Error in docker pull down image“ https://registry-1.docker.io/v2/ : Net / http: TLS handle timeout “how to handle?