搭建好Jenkins后,在script中使用Ubuntu:16.04的镜像测试,构建后提示如下:

Cannot connect to the Docker daemon. Is the docker daemon running on this host?
Build step 'Execute shell' marked build as failure

Docker实际已经运行,应该是权限方面的问题:

sudo gpasswd -a jenkins docker

重新启动Jenkins的服务即可。