Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 5962

Docker Permission Denied through Jenkins pipeline

$
0
0

I have installed Docker using apt in ubuntusudo apt install docker.ioAnd have installed JDK 17 as well as Jenkins.

So Whenever I try to build a docker image using Dockerfile through Jenkins which is in a different location than my build work space , it throws me an error stating

unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /home/ubuntu/github_folder: permission denied

The Image gets build if I use the dockerfile from the same workspace i.e my GitHub folder which includes a Dockerfile.

I have tried to insert jenkins user in all the possible groups

sudo usermod -a -G docker jenkins sudo usermod -a -G jenkins ubuntusudo usermod -a -G jenkins root

Still getting the same permission denied error.

I even checked with my dockerfile which is present in the location, and it defines "Dockerfile" with no extensions.

My pipeline :

pipeline {    agent any    stages {        stage("Checkout Code") {            steps {                cleanWs()                git branch: 'main', url: '<githublink>'            }        }        stage("Build Docker Image") {            steps {                script {                    sh 'docker build -t uditdevadiiga/chatbot -f /var/lib/jenkins/workspace/<path>/Dockerfile .'                }            }        }    }}

Viewing all articles
Browse latest Browse all 5962

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>