'Error when running any docker command by Jenkins on pipeline : /home are not currently supported

I am running jenkins and docker on Ubuntu server 20.04 LTS.

when starting jenkins pipeline to run docker commands, I have this error:


Sorry, home directories outside of /home are not currently supported. See https://forum.snapcraft.io/t/11209 for details. script returned exit code 1


Can anyone help me ? Thank you!

the script is below

pipeline {
    agent any
    
    tools {
        nodejs "nodejs"
        gradle 'gradle'
        
    }
    
    stages {
        stage('clean'){
            steps{
                sh 'docker-compose down'
                step([$class: 'WsCleanup'])
                
            }
        }
        stage('clone'){
            steps{
                git branch: 'develop', credentialsId: 'key', url: 'url'
            }
        }
        stage('front_build'){
          steps{
                dir('frontend'){
                    sh 'npm install'
                    sh 'npm run build'
                }
            }
        }
        stage('back_build'){
          steps{
                dir('backend'){
                    sh 'gradle clean'
                    sh 'gradle build'
                }
            }
        }
        stage('deploy'){
            steps{
                sh 'docker-compose up --build'
            }
        }
    }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source