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.

Building Docker fails to chmod it .sh files

See original GitHub issue

I have a script in src/docker/opt/docker/bin/launch.sh.

The generated Dockerfile:

RUN ["chmod", "-R", "u=rX,g=rX", "/opt/docker"]
RUN ["chmod", "u+x,g+x", "/opt/docker/bin/server"]
RUN ["chmod", "u+x,g+x", "opt/docker/bin/launch.sh"]

See the missing / in front of opt that leads to the following error when Docker/publishLocal:

chmod: cannot access 'opt/docker/bin/launch.sh': No such file or directory

Workaround:

inConfig(Docker)(
  dockerPackageMappings := MappingsHelper
    .contentOf(sourceDirectory.value)
    .map { case (from, to) => from -> Paths.get("/", to).toString }
)

Thanks

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
muuki88commented, Jun 13, 2020

Thanks a lot for putting together a reproducible test case.

To he honest I don’t know if I have the time to work on this, but if you would like to do I’ll give you all necessary guidance you need 😊

1reaction
adarshajcommented, Jun 10, 2020

@muuki88 - I’ve created a repro here: https://github.com/hackcave/sbt-native-packager-docker-issue-1304 , sbt docker:publishLocal should give you the error. we can see the file exists at /opt/bin/docker/entrypoint.sh within the docker image, but the generated chmod command fails to add / prefix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

docker run fails to run shell script (file not found) although the ...
Now here comes with my problem, when I execute docker run like below, I get the error: docker run -i privaterepoexample/sre docker: Error...
Read more >
chmod not working correctly in Docker - Server Fault
The default shell of RUN in Docker is /bin/sh and this is where the permissions not being set correctly actually has a problem....
Read more >
Dockerfile RUN chmod does not work - Compose
I'm working on a project for a home webservice and I am setting up a bind9 container using docker-compose.
Read more >
Troubleshooting Docker Permission Denied Problems
Many factors could lead to a permission denied error while connecting to Docker. One of those factors is that you may be running...
Read more >
How to Fix Docker Permission Denied? - phoenixNAP
How to Fix Docker Permission Denied? · What is Docker Permission Denied Error · Method 1: Restart Docker Engine · Method 2: Run...
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