当我尝试在 WSL 内的 docker 内启动 jenkins 时,出现权限问题。
⇒ sudo docker run --name jenkins_3 -p 8081:8080 -p 50001:50000 -e JAVA_OPTS="-Djava.io.tmpdir=/mnt/c/exemple_dir" jenkins
/usr/local/bin/jenkins.sh: line 23: cannot create temp file for here-document: Permission denied
Running from: /usr/share/jenkins/jenkins.war
webroot: EnvVars.masterEnvVars.get("JENKINS_HOME")
Exception in thread "main" java.io.IOException: Jenkins has failed to create a temporary file in /tmp
at Main.extractFromJar(Main.java:397)
at Main._main(Main.java:230)
at Main.main(Main.java:132)
Caused by: java.io.IOException: Permission denied
at java.io.UnixFileSystem.createFileExclusively(Native Method)
at java.io.File.createTempFile(File.java:2024)
at Main.extractFromJar(Main.java:394)
我的 /tmp 文件夹拥有所有权限
⇒ ls -ald /tmp
drwxrwxrwt 1 root root 512 Jun 13 13:45 /tmp
./bin权限:
⇒ ls -ald /usr/local/bin
drwxrwxrwx 1 root root 512 Jun 4 16:07 bin