Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding executable guard to Dockerfile #5

Merged
merged 1 commit into from
Dec 15, 2021

Conversation

motleydev
Copy link
Contributor

At least "this" user forgot to make the script executable while moving files about. For those who work with bash scripts less frequently. Again, like this user, this is a good tip picked up from https://nickjanetakis.com/blog/docker-tip-86-always-make-your-entrypoint-scripts-executable to help guard against this case.

At least "this" user forgot to make the script executable while moving files about. For those who work with bash scripts less frequently. Again, like this user, this is a good tip picked up from https://nickjanetakis.com/blog/docker-tip-86-always-make-your-entrypoint-scripts-executable to help guard against this case.
@anuaimi
Copy link
Contributor

anuaimi commented Dec 13, 2021

Glad it's working.

One note, while the current fix works, the more common way to resolve this it to change the permission on the file itself rather than when you run it in Docker.

chmod +x entrypoint.sh
git add entrypoint.sh
git commit -m "fix permissions on entrypoint script"

Now the file can be run as a script no matter if you run it locally or in a docker container.

This is just a FYI as both approaches will work in your current scenario.

@crcastle
Copy link
Contributor

Hi @motleydev- It looks like that file is set as executable (like @anuaimi suggests) so RUN chmod +x /opt/render/entrypoint.sh shouldn't be required in the Dockerfile:
CleanShot 2021-12-14 at 15 09 17@2x

Did you maybe edit it or recreate it?

@motleydev
Copy link
Contributor Author

@crcastle Yes, if you take the default example, but if you move files around, or copy and paste from the web, the problem occurs when some file action (new, copy, etc) results in a non executable - which after some Googling, appears to happen fairly often which is why that line was listed as a good practice or "tip", feel free to reject this PR if you don't find it helpful, I just thought it's a simple step that mitigates this exact scenario, but I'm a sample point of one :)

@crcastle
Copy link
Contributor

@motleydev I believe your change cannot do any harm because chmod is idempotent. Thanks for the PR!

@crcastle crcastle merged commit 206529b into render-examples:master Dec 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants