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

[Feature Request]: add UNION to Dockerfile syntax #29719

Closed
fshp opened this issue Dec 27, 2016 · 7 comments
Closed

[Feature Request]: add UNION to Dockerfile syntax #29719

fshp opened this issue Dec 27, 2016 · 7 comments
Labels
area/builder kind/feature Functionality or other elements that the project doesn't currently have. Features are new and shiny

Comments

@fshp
Copy link

fshp commented Dec 27, 2016

To reduce the number of layers, combining technique used commands through the operator "&&".

But this operator can not be combined arbitrary commands, only the commands in RUN.

I propose to introduce a new unit construction in Dockerfile syntax, which allows to combine several commands in one commit.

For example:

Instead

RUN apt-get update && \
    apt-get dist-upgrade --no-install-recommends -y

You can write

BEGIN
RUN apt-get update
RUN apt-get dist-upgrade --no-install-recommends -y
END

But such a structure in the current syntax in general is impossible:

BEGIN
ADD binary /binary
RUN /binary
END
@AkihiroSuda AkihiroSuda added the kind/feature Functionality or other elements that the project doesn't currently have. Features are new and shiny label Dec 27, 2016
@AkihiroSuda
Copy link
Member

Starting from Docker 1.13, you can use docker build --squash to squash layers

--squash                     Squash newly built layers into a single new layer

Does it satisfy your requirement?

@fshp
Copy link
Author

fshp commented Dec 27, 2016

@AkihiroSuda great!
But this flag is very radical.
It can not combine part. Just everything.

But for my needs that's enough. Thank you.

@thaJeztah
Copy link
Member

There's a number of similar issues that were opened in the past, but closed
because the Dockerfile syntax was frozen;

#1554, #1799, #16058

Also this one: #12198, and this one may be relevant here as well #7115

@fshp
Copy link
Author

fshp commented Dec 27, 2016

@thaJeztah thanks you for links. It was interesting to read. So I close this.

@FranklinYu
Copy link

@thaJeztah The Dockerfile syntax was frozen, but you "unfroze" it in 0725045. So is this feature under consideration now?

@muescha
Copy link

muescha commented Jan 6, 2018

i would like to have same syntax like in a bash file (so i can copy and paste the content):

RUN BEGIN
  apt-get update
  apt-get dist-upgrade --no-install-recommends -y
END

or

RUN {
  apt-get update
  apt-get dist-upgrade --no-install-recommends -y
}

@thaJeztah
Copy link
Member

Those following this issue may be interested in #34423

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/builder kind/feature Functionality or other elements that the project doesn't currently have. Features are new and shiny
Projects
None yet
Development

No branches or pull requests

6 participants