Can't docker run java project image which used jlink tool: Permission denied, unknown error
See original GitHub issueEnvironment:
- Jib version: jib core version 0.14.0
- *Build tool: I can’t find anything to use scratch base image with gradle plugin
- OS: Manjaro Arch based linux
Description of the issue:
I can’t docker run java project image which used jlink tool. Permission denied, unknown
error gives when run executable file.
Expected behavior:
Steps to reproduce:
- Add the gradle dependency to this example
compile group: 'com.google.cloud.tools', name: 'jib-core', version: '0.14.0'
- Run following task
task dojib {
def builder = Jib.fromScratch()
builder.setEntrypoint("/bin/demo")
builder.setCreationTime(Instant.now())
builder.addFileEntriesLayer(FileEntriesLayer.builder().addEntryRecursive(Path.of("$buildDir/image/cp"), AbsoluteUnixPath.get('/cp')).build())
builder.addFileEntriesLayer(FileEntriesLayer.builder().addEntryRecursive(Path.of("$buildDir/image/bin"), AbsoluteUnixPath.get('/bin')).build())
builder.addFileEntriesLayer(FileEntriesLayer.builder().addEntryRecursive(Path.of("$buildDir/image/conf"), AbsoluteUnixPath.get('/conf')).build())
builder.addFileEntriesLayer(FileEntriesLayer.builder().addEntryRecursive(Path.of("$buildDir/image/legal"), AbsoluteUnixPath.get('/legal')).build())
builder.addFileEntriesLayer(FileEntriesLayer.builder().addEntryRecursive(Path.of("$buildDir/image/lib"), AbsoluteUnixPath.get('/lib')).build())
builder.containerize(Containerizer.to(DockerDaemonImage.named("example")))
}
- Run the docker image which named “example” and see the error.
Log output:
docker: Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"/bin/demo\": permission denied": unknown.
ERRO[0000] error waiting for container: context canceled
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Troubleshooting Docker Permission Denied Problems
If you're running into errors like docker permission denied, use this tutorial as your troubleshooting guide!
Read more >getting permission denied in docker run - Stack Overflow
It throws following error: container_linux.go:247: starting container process caused "exec: \"/entrypoint.sh\": permission denied" docker: ...
Read more >How to Fix Docker Permission Denied? - phoenixNAP
Method 2: Run Docker Commands with sudo The "Permission Denied" error appears only with non-root users. Running the command with sudo to ...
Read more >Fix the Jenkins Docker error: Permission denied when trying ...
To fix the Jenkins Docker permission denied error, just run a usermod command in the terminal and reboot.
Read more >Containerizing Apps with jlink - Oracle Blogs
In this era of containerization, that means small Docker images. ... to use jlink, which is a command-line utility available since Java 9, ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Also I’m not sure if it’ll be easy to create a working image from “scratch”, much like the “FROM scratch” in
Dockerfile
. You may considering starting from some base image.Thanks for the update. Just FYI and for future documentation:
Jib Core is a general tool to build a container image, so I am certain you can create a working image as long as you supply the right runtime libraries or use the right base image that already contains the libraries from the right OS/architecture. Even with the Jib Maven plugin (not Jib Core), I was able to build a working jlink application with some tweak and tricks.