Jyme
Jyme

Reputation: 342

Permission denied on Jenkins job

I'm running pipeline job with this pipeline script

node {
    stage ('Prepare Environment') {
      checkout scm
      sh 'npm install'
    }
    stage('Build') {
      sh 'docker-compose --verbose up -d'
    }
}

and there is an error on docker-compose

compose.config.config.find: Using configuration files: ./docker-compose.yml
docker.auth.find_config_file: Trying paths: ['/var/lib/jenkins/.docker/config.json', '/var/lib/jenkins/.dockercfg']
docker.auth.find_config_file: No config file found
Traceback (most recent call last):
  File "bin/docker-compose", line 6, in <module>
  File "compose/cli/main.py", line 71, in main
  File "compose/cli/main.py", line 121, in perform_command
  File "compose/cli/command.py", line 40, in project_from_options
  File "compose/cli/command.py", line 118, in get_project
  File "compose/cli/command.py", line 93, in get_client
  File "site-packages/docker/api/daemon.py", line 177, in version
  File "site-packages/docker/utils/decorators.py", line 46, in inner
  File "site-packages/docker/api/client.py", line 191, in _get
  File "site-packages/requests/sessions.py", line 521, in get
  File "site-packages/requests/sessions.py", line 508, in request
  File "site-packages/requests/sessions.py", line 618, in send
  File "site-packages/requests/adapters.py", line 490, in send
requests.exceptions.ConnectionError: ('Connection aborted.', error(13, 'Permission denied'))

Also I've tried to follow this command in same machine with jenkins user in the same directory, it's work fine with no error.

Upvotes: 1

Views: 3369

Answers (2)

Jyme
Jyme

Reputation: 342

It seem there is problem with jenkins job executor don't reload shell permission even I've restart jenkins with /restart multiple times.

But restart jenkins deamon using systemctl restart jenkins will do the job.

Upvotes: 0

Nicola Ben
Nicola Ben

Reputation: 11317

It seems a permission problem, maybe your docker-compose.yml file (or the binary file) is readable only by jenkins user.

Upvotes: 1

Related Questions