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

No way to run commands that need root access from /docker-entrypoint-initdb.d #331

Open
sherwynsaul opened this issue Dec 20, 2022 · 1 comment

Comments

@sherwynsaul
Copy link

I need to create an ssh tunnel, before I can get a dump of a dev db. This involves installing openssh and running ssh. While I can do the installs and possibly create the tunnel from the Dockerfile.

I say possibly because the exact same commands that work if I start container run through the bash shell, do not work if I run them from Dockerfile. There is an invalid format error on the private key; the exact same private key the works if I run under bash from a running container. But that is another issue.

Anyway, I am pretty sure I am not the only one who has gone through this. It seems years ago this was not an issue as we could run scripts as root or at least commands as root in the startup scripts in ./docker-entrypoiint-initdb.d, however this is not the case anymore. I figure there is some work around or best practice. But I have not been able to find it.

I have also posted on stackoverflow about this.

https://stackoverflow.com/questions/74855870/open-ssh-tunnel-during-postgis-docker-build?noredirect=1#comment132105437_74855870

Seems the closest information I have found to what I am trying to do is
docker-library/postgres#973

And it seems like the advise is to create a custom Image from postgres image. Is this still the recommendation? Just seems like there should be a way to run root commands in a startup script.

Any help would be greatly appreciated.

@Laro88
Copy link

Laro88 commented Jan 2, 2023

I had the same problem as you @sherwynsaul, however it worked for me using the postgis/postgis:15-3.3-alpine

Sidenote, I was using mdillons postgis distribution before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants