question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't docker run java project image which used jlink tool: Permission denied, unknown error

See original GitHub issue

Environment:

  • 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:

  1. Add the gradle dependency to this example compile group: 'com.google.cloud.tools', name: 'jib-core', version: '0.14.0'
  2. 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")))
}
  1. 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:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
chanseokohcommented, Jan 26, 2021

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.

def builder = Jib.fromScratch()
0reactions
chanseokohcommented, Jun 3, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found