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

Allow ENV to set multiple variables in one layer #2333

Closed
mingfang opened this issue Oct 22, 2013 · 19 comments · Fixed by #8251
Closed

Allow ENV to set multiple variables in one layer #2333

mingfang opened this issue Oct 22, 2013 · 19 comments · Fixed by #8251

Comments

@mingfang
Copy link

Currently each ENV command sets one variable and results in one layer.
Due the limitation of AUFS to 48 layers, it would be very helpful to allow ENV to set multiple variables at once.
Maybe like an array ENV ["key1=value1", "key2"=value2"]

@creack
Copy link
Contributor

creack commented Dec 6, 2013

Marking as easyfix.
@mingfang Note that the 42 layer will soon get raised to 127 and might get remove altogether.

@pitex
Copy link

pitex commented Dec 10, 2013

I will work on it

@crosbymichael
Copy link
Contributor

I think this is a good idea. We do the same for EXPOSE and VOLUMES so I think ENV will be fine as well

@cpuguy83
Copy link
Member

#3368

@mikz
Copy link

mikz commented Apr 29, 2014

This would be awesome. It is really pity #3368 got closed.

@crosbymichael
Copy link
Contributor

@mikz That PR was closed but we proposed a format that would be accepted.

@mikz
Copy link

mikz commented Apr 29, 2014

@crosbymichael but the parser for that syntax it not yet implemented, right?

@crosbymichael
Copy link
Contributor

Not that I know of but it would be easy to implement for this PR.

@mikz
Copy link

mikz commented May 7, 2014

@crosbymichael what are the requirements for this to make it to 1.0?
When it would have to be implemented? Is it even possible?

@iwinux
Copy link

iwinux commented Jun 26, 2014

Is it related to #332?

@lox
Copy link

lox commented Sep 17, 2014

We're investigating implementing this with the changes introduced by #7461, is anyone else looking at it?

The syntax that @shykes mentioned was:

# Original syntax is not broken. Note the spaces in the value, they are properly supported
ENV FOO B   A   R  
# New shell-style syntax. Values can't have a space.
ENV foo=bar color=red answer=42
# Until we get around to interpreting special characters, they should be forbidden as regular characters to preserve forward-compatibility. So the following line should cause an error
ENV foo="bar baz" color=dark\ red

Is anyone opposed to that?

@cpuguy83
Copy link
Member

@lox I would prefer to just make ENV (and other consecutive nop commands) happen in one commit. But IANTM

@lox
Copy link

lox commented Sep 17, 2014

Is there an issue related to specifically that issue @cpuguy83? I agree that would be a more worthy objective.

@tianon
Copy link
Member

tianon commented Sep 17, 2014

+1 I was thinking about exactly this today; now that we have a proper
parser, it should be "easier" to have it look ahead and coalesce multiple
"metadata" lines together into a single layer instead of many empty layers

@iwinux
Copy link

iwinux commented Sep 17, 2014

@lox the syntax looks much cleaner 👍

On the "special chars" part, what characters would be forbidden (besides " and \)?

@erikh
Copy link
Contributor

erikh commented Sep 17, 2014

Yup. :) The parser is completely independent of the evaluator, so there could be an optimizer step in between or something similar if we wanted.

On Sep 16, 2014, at 7:29 PM, Tianon Gravi notifications@github.com wrote:

+1 I was thinking about exactly this today; now that we have a proper
parser, it should be "easier" to have it look ahead and coalesce multiple
"metadata" lines together into a single layer instead of many empty layers

Reply to this email directly or view it on GitHub.

duglin pushed a commit to duglin/docker that referenced this issue Nov 20, 2014
still supports the old form: ENV name value

Also, fixed an issue with the parser where it would ignore lines
at the end of the Dockerfile that ended with \

Closes moby#2333

Signed-off-by: Doug Davis <dug@us.ibm.com>
mapuri pushed a commit to mapuri/docker that referenced this issue Dec 4, 2014
still supports the old form: ENV name value

Also, fixed an issue with the parser where it would ignore lines
at the end of the Dockerfile that ended with \

Closes moby#2333

Signed-off-by: Doug Davis <dug@us.ibm.com>
@andkirby
Copy link

andkirby commented Mar 24, 2017

Could someone tell since which Docker version should have this feature?

@cpuguy83
Copy link
Member

1.4

@andkirby
Copy link

Thanks for quick answer! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment