g0t4/course-jenkins-getting-started

Can not write to /var/jenkins_home/copy_reference_file.log

itofficeeu opened this issue · 2 comments

When using docker-compose up the running fails with

'''
~/Desktop/jenkinstest/course-jenkins-getting-started/dockers/compose$ docker-compose up
Starting compose_jenkins_1 ... done
Starting compose_mails_1 ... done
Attaching to compose_mails_1, compose_jenkins_1
mails_1 | 2022/03/18 14:41:48 Using in-memory storage
jenkins_1 | touch: cannot touch '/var/jenkins_home/copy_reference_file.log': Permission denied
mails_1 | 2022/03/18 14:41:48 [SMTP] Binding to address: 0.0.0.0:1025
mails_1 | 2022/03/18 14:41:48 Serving under http://0.0.0.0:8025/
jenkins_1 | Can not write to /var/jenkins_home/copy_reference_file.log. Wrong volume permissions?
mails_1 | [HTTP] Binding to address: 0.0.0.0:8025
'''

and a bunch of

'''
jenkins_1 | touch: cannot touch '/var/jenkins_home/copy_reference_file.log': Permission denied
jenkins_1 | Can not write to /var/jenkins_home/copy_reference_file.log. Wrong volume permissions?
'''

I have tried (for testing) to set the permissions of the folder to 777, not working either
'''
course-jenkins-getting-started/dockers/compose$ sudo chmod -R 755 jenkins_home_on_host
'''

NOT helping either:
course-jenkins-getting-started/dockers/compose$ sudo chown -R jenkins:jenkins jenkins_home_on_host

Seems a problem with the jenkins repo, but for using this tut/repo from g0t4, the tut here needs some additions described in the link below.

Details here: jenkinsci/docker#177 (comment)
... This does NOT help entirely either. Plugins will not load entirely.

Suggested work-around is to disable the folder binding in the docker-compose file and access the logs by entering the containers with "docker exec -it bla-bla".

'''
#volumes:
#- ./jenkins_home_on_host:/var/jenkins_home
'''

  • Which now after testing proves NOT to work either. Plugins will not load entirely.

Hi @itofficeeu

I've tried docker command first: docker run -d -p 8080:8080 -v jenkins_home:/var/jenkins_home jenkins/jenkins:lts

then I didn't remove the .jenkins folder under my home folder but simply continue to created a docker-compose.yml file and copied all of the content of the course's yml file, however I did need to change the jenkins version to a newer one as when I install the plugins, it all failed with error complaining the jenkins version, therefore, I gave the version that the requires for my case was to be lts rather the specified older version in your yml file. It works for me. Before you try again, remove the folder jenkins_home jenkins first then run the docker-compose up again.

Hope this is helpful.

Very kind of you, @YunjunWang, thanks. I will try that out next time I work with the tutorial.