Resolved - Home Directory Issue - Jenkins DockerHub

Hi All,

Apologize if this is already discussed in the forum earlier but unable to find a satisfactory resolution or easy explanation to resolve the below issue.

I am trying to build an application using DockerHub, Jenkins (latest) hosted on Ubuntu - 20.10 (Groovy Gorilla) and snap version - 2.47.1+20.10.1. My home directory is located in /home/ubuntu.

I always get the below error in Jenkins and the build does not proceed ahead. (Detailed error code posted at the end for reference.)
“Sorry, home directories outside of /home are not currently supported.
See Support for non /home homedirs for details.”

A section of the sanitized code from my Jenkinsfile is mentioned below for reference:

Code Follows-------

pipeline {
environment {
registry = “somerepo/someuser”
registryCredential = “dockerhub”
dockerImage = ‘’

}

agent any

stages {
stage(‘Build Docker Image’) {
steps {
script {
dockerImage = docker.build registry + “:$BUILD_NUMBER”
}
}
}

Code Ends ------

Error Note from Jenkins Follows:-------

Commit message: “New Jenkinsfile created”
[Pipeline] }
[Pipeline] // stage
[Pipeline] withEnv
[Pipeline] {
[Pipeline] withEnv
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Build Docker Image)
[Pipeline] script
[Pipeline] {
[Pipeline] isUnix
[Pipeline] sh

  • docker build -t somerepo/someuser:5 .
    Sorry, home directories outside of /home are not currently supported.
    See Support for non /home homedirs for details.

Request you to please guide me (a new developer) to resolve the above issue.

Thanking you.

Regards,
May

What is the home directory of the jenkins user?

Hello ijohnson,

The config is as follows:
HOME: /var/lib/jenkins
JENKINS HOME:/var/lib/jenkins

Regards,
May

Resolved the issue. Changed the home directory for Jenkins from /var/lib/jenkins to /home/username/jenkins.

Thanks all, this issue is now closed and resolved by me.

2 Likes