I am trying to use python image to build and test a very simple python project. But when I give Docker Image name in Jenkinsfile, it fails to pull the image.
[drone-python_test-jenk-NVHH77CLU5PUMV6UVRK62EARJB3DUVF5FWILYVRZDXOE54RACN2Q] Running shell script
+ docker pull python
Using default tag: latest
Warning: failed to get default registry endpoint from daemon (Cannot connect to the Docker daemon. Is the docker daemon running on this host?). Using system default: https://index.docker.io/v1/
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
script returned exit code 1
JenkinsFile
pipeline {
agent {
docker {
image 'python'
}
}
stages {
stage('Build') {
steps {
sh '''virtualenv --no-site-packages .env
'''
sh '.env/bin/pip install -r dev-requirements.txt'
}
}
stage('Test') {
steps {
sh 'flake8 setup.py drone tests'
}
}
stage('test2') {
steps {
sh 'nosetests --with-coverage --cover-package drone -v'
}
}
}
Edit: Tried mounting the docker host using a docker-compose file
version: '2'
services:
jenkins:
image: jenkinsci/blueocean
ports:
- 8888:8080
volumes:
- /var/run/docker.sock:/var/run/docker.sock
restart: always
also added user jenkins
to docker group(is this correct user?)
But it still did not work. DroneIO also used docker images to setup environment but it did not have this issue.