-
Notifications
You must be signed in to change notification settings - Fork 153
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
Add entrypoint
routing, which supports routing string-based commands to different executables, with special logic for pwsh
#398
Comments
I feel like this would be ideal for the refactor we were discussing a month or so ago, and I feel like in between these releases is the perfect time to get that in motion. |
I found this, which would break, but it is our code and no longer used.
|
add support for |
1/3 of the docker files define entry point and definitely won't be affected. Most executions of the image where either |
When I first saw this issue I thought it was pretty cut and dried but the more I think about it, that definitely does not seem to be the case 😸. FWIW, I have a couple questions/comments
Maybe it would be helpful to capture the usage scenarios and the expected behavior in this issue. |
So I spoke to @TravisEz13 offline and spent a bunch more time with Docker entrypoint scripts in some home projects, and think I can accurately describe the behavior now.
|
@PowerShell/powershell-committee reviewed the behavior I outlined above, there's a couple other cases without quotes around the last arg of the run, but none of them are problematic either. We're marking as approved. |
@joeyaiello - Which of these scenarios require entry entrypoint script versus simply defining the ENTRYPOINT to be pwsh? In the long term, it feels like avoiding the entrypoint script would be the preferred solution. The entrypoint script makes it difficult for users to self discover what the entrypoint behavior is. You can't rely on |
Interesting topic. Few thoughts for you to consider:
|
Tested and works:
This will break with a entry point of
|
I was thinking more about this. This issue has the wrong title. It very much underplays what is being asked for. This is the feature description, and scope, I think:
|
entrypoint
routing, which supports routing string-based commands to different executables, with special logic for pwsh
@richlander I updated the title and added a goals section to the description based on your comments |
@MichaelSimons The entrypoint behavior we've defined in the script is basically: If we want to make the Re: the long-term compat burden, I agree, but I don't think this has to be a slippery slope. Conceptually, this is a very thin wrapper around I agree with you that a few of those original languages aren't 1:1 comparisons, and @TravisEz13 and I spoke pretty extensively about it, agreeing that there really wasn't a clear answer. The most apt comparison in my mind is Bash, where you're wanting to execute both .sh scripts / arbitrary executables as well as in-lined script, and where doing the former can be done via the latter. The big difference, as I noted above, is that opening Bash from Bash is very, very fast, and opening PowerShell from PowerShell is not. I also agree we should address this on Windows as well, and I think @TravisEz13 is working on the .bat/.cmd equivalent already. |
Goal
Add
entrypoint
routing, which supports routing string-based commands to different executables, with special logic forpwsh
. In order to:--entrypoint
syntax to specify an executable, andentrypoint
(an argument to docker run) from its arguments (arguments to the container; they show up last).Background
The best practice in docker is for an image to run the product in contains.
https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#entrypoint
Currently our images only run PowerShell when no command is specified. This is specified in the
CMD
entry in the Dockerfile.Unfortunately, making the change causes a breaking change to the image in what is hopefully a corner case.
Customer requests for this are in #274 and #394
Proof of concept is here: #399
Other Language images
Proposal
pwsh -nologo -l -c "$@"
ENTRYPOINT
CMD
to[ "pwsh" ]
New Scenario
Note the lack of
pwsh -c
.Will continue to work
Breaking change
Scenario - Running PowerShell using container
Working command with current images
Scenario - Expected result (with current image)
Actual result (with private build with change)
Workaround
Use
--%
to prevent the new PowerShell entrypoint from parsing the command.Entry point script - Ubuntu
The text was updated successfully, but these errors were encountered: