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

Avoiding chown to reduce the image size #544

Closed
dje06 opened this issue Aug 25, 2016 · 6 comments · Fixed by #1301
Closed

Avoiding chown to reduce the image size #544

dje06 opened this issue Aug 25, 2016 · 6 comments · Fixed by #1301
Assignees

Comments

@dje06
Copy link

dje06 commented Aug 25, 2016

The issue #175 introduced an extra layer for the chown that is doubling the content size of the chown ed folder (for an image containing the jdk+jboss it could be huge).
Is it possible to avoid this extra layer using a single CMD (without the COPY)?

By doing a curl and chown in the same RUN command, this drastically reduces the image size, but in this case I have to use an external Dockerfile and I'd prefer being fully maven-style (using the assembly).

Any idea how to fix this?

@rhuss
Copy link
Collaborator

rhuss commented Sep 1, 2016

I see the point, but I wonder how we could doing the COPY / ADD from the assembly and the chown in one layer. The real pita is that moby/moby#6119 doesnt get fixed.

If you have an idea I'm happy to add this as an optimization.

@smallsmallc
Copy link

smallsmallc commented Jul 30, 2018

@rhuss Hi Roland, as moby/moby#6119 is fixed now, could you please kindly make an optimization?

@rhuss
Copy link
Collaborator

rhuss commented Jul 30, 2018

Good point, will start working on it hopefully soonish. Do you know the Docker (or even better API) version, since when these flags are available ?

@smallsmallc
Copy link

The feature is included in Docker 17.09 and up quoted from moby/moby#6119

@KowKiller
Copy link

I also noticed another downside of current implementation.
Since the temporary directory name is randomly generated, docker can't reuse the build cache even if the content of the assembly is not changed.

image

Using --chown would solve this too.

@rhuss
Copy link
Collaborator

rhuss commented Nov 21, 2019

@rohanKanojia If you have some spare cycles (not necessarily for the next release), could you give a look to get rid of our own chown mechanism and use that from Docker (for Docker >= 17.09) ?

@rohanKanojia rohanKanojia self-assigned this Nov 21, 2019
rohanKanojia added a commit to rohanKanojia/docker-maven-plugin that referenced this issue Nov 22, 2019
rohanKanojia added a commit to rohanKanojia/docker-maven-plugin that referenced this issue Nov 25, 2019
rohanKanojia added a commit to rohanKanojia/docker-maven-plugin that referenced this issue Dec 19, 2019
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

Successfully merging a pull request may close this issue.

5 participants