-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Fix cmd and entrypoint handling in parser #7806
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
Conversation
|
There should be a button at the bottom of each PR that says "watch" or something similar. Click that. |
|
Oh, sorry for being unclear. I'm watching the whole Docker repo already, so that's not a problem, but I want to relate 'versioning' issues to my proposal, but wasn't really sure 'which way around' I should link; i.e. Link this issue from my issue, or the other way around :) |
|
There are going to be at least several dockerfile-related tickets before 1.3 is released; I would prefer they not all be cluttered up this way. The maintainers get a lot of email already. I appreciate the enthusiasm though and I hope to address versioning soon. :) On Aug 30, 2014, at 5:04 AM, Sebastiaan van Stijn [email protected] wrote:
|
|
Ok, I'll remove my comment. Thought it could be useful to collect/group version related issues at a central location, but don't want to spam the maintainers obviously. Meanwhile, will keep track on progress and other suggestions are of course welcome! |
|
I still don't see cli test on empty entrypoint :) |
|
@LK4D4 👍 |
|
Also, next tests fails with this PR: |
|
I have tested these by hand and they do not fail, which makes me think that the tests are busted, and not the code. Testing master now, will reply in a bit. -Erik On Sep 1, 2014, at 11:34 AM, Alexandr Morozov [email protected] wrote:
|
|
They don’t fail on master :( I will keep investigating. On Sep 1, 2014, at 1:11 PM, Erik Hollensbe [email protected] wrote:
|
|
Added a test for The reason I’m commenting now is because the behavior might be different. Now: When ENTRYPOINT is blank, and CMD is also blank: set ENTRYPOINT to ‘/bin/sh -c’ I think this is the desired behavior, but please advise if there was a specific way it was done before. On Sep 1, 2014, at 1:20 PM, Erik Hollensbe [email protected] wrote:
|
|
You can't change it or it'll break existing Dockerfiles |
|
What is the existing behavior? If I change that code again, other tests will break. On Sep 1, 2014, at 1:39 PM, Victor Vieux [email protected] wrote:
|
|
|
|
In TestBuildWithVolumeOwnership, ENTRYPOINT and CMD are inherited and ENTRYPOINT appears to be blank. This test will fail due to varargs in the run command not being processed correctly. TestBuildNoContext overrides CMD but not ENTRYPOINT, which is also inherited, but from no context. This will break if ENTRYPOINT is blank, which it is in this case because of the busybox image, and since it is a ‘sh -c’ type of CMD. The test will fail complaining of no ‘echo’ in $PATH, which never gets set because sh -c is never run. These were resolved by the changes in this PR. I’m happy to integrate whatever you want, but as you can see this gets fairly hairy (and these is only a few of the tests). Just let me know what the desired behavior should be, and I’ll try to match it. On Sep 1, 2014, at 1:45 PM, Victor Vieux [email protected] wrote:
|
|
Just a note on the volume tests — these pass when run independently. I’m wondering if some state is persisting. Making notes for later, please don’t mind the noise. On Sep 1, 2014, at 1:51 PM, Erik Hollensbe [email protected] wrote:
|
|
+1; "sh -c" will definitely break stuff When the command is finally run, we do a LookupPath on the first item in |
|
I’ll review whether PATH is being honored, but I didn’t touch anything in runconfig, so I can’t see why it would change. On Sep 2, 2014, at 12:04 PM, Tianon Gravi [email protected] wrote:
|
|
Ok, this should be ready for merge now; all tests pass. Please review @LK4D4 @tiborvass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer this as separate test as edge case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, PTAL
On Sep 3, 2014, at 6:15 AM, Alexandr Morozov [email protected] wrote:
In integration-cli/docker_cli_build_test.go:
@@ -766,6 +766,25 @@ func TestBuildEntrypoint(t *testing.T) {
if res != expected {
t.Fatalf("Entrypoint %s, expected %s", res, expected)
}
+
- deleteImages(name)
- expected = "[]"
I prefer this as separate test as edge case.—
Reply to this email directly or view it on GitHub.
|
@erikh you did not remove the test you extracted, from the original test. |
|
lol whoops, fixed now On Sep 4, 2014, at 1:58 PM, Tibor Vass [email protected] wrote:
|
|
Sorry, but may I chime in here. I have question about this. I'm setting up some Docker containers that run certain programming environments. Hence, I run the containers with the program, say Python, as default entrypoint because I want to be able to call the program with options. But most of the time I just run it without any additional options. That's why I specify in the Dockerfiles:
This allows me to run the programm either with or without options. Should I do this differently now? If so I would change this pretty soon should Docker break this behaviour at some point. |
|
@lord-garbage
|
|
I can write a test |
|
My bad, I don't actually have |
|
LGTM |
builder/dispatchers.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this check happen earlier?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no. unless I'm misunderstanding you, this is propagated from the parser, so there will only be one argument if the CMD was not json encoded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well you are consuming the value in args = append([]string{b.image}, args...) then later checking if it is == "" before erroring out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ohhh. ok. I'll fix it rihgt away.
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <[email protected]> (github: erikh)
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <[email protected]> (github: erikh)
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <[email protected]> (github: erikh)
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <[email protected]> (github: erikh)
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <[email protected]> (github: erikh)
autoConfig seeding of entrypoint. Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <[email protected]> (github: erikh)
… function Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <[email protected]> (github: erikh)
dispatcher Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <[email protected]> (github: erikh)
|
@crosbymichael last commit fixes your concerns. |
|
LGTM |
|
@erikh is there an issues that this fixes? |
Fix cmd and entrypoint handling in parser
This utilizes a test provided by @cnf which exposed an issue with the parser injecting
""for empty json values, which was then interpreted as a value itself by the evaluator. Removing this exposed a ton of fiddly order-dependent bits around entrypoint and cmd, which then needed to be fixed as well.Hopefully we can address this with versioning and clarifying semantics.