Coder Social home page Coder Social logo

Comments (4)

davidxia avatar davidxia commented on July 23, 2024

@aburnett So the Dockerfile command should be ADD /opt/apps/spar-api.tar.gz /opt/apps/?

from docker-maven-plugin.

chris-snider avatar chris-snider commented on July 23, 2024

Hi,

According to the docker docs, an ADD is supposed to copy and unpack if in a recognized format. If you want to have a copy of the tar.gz in the resulting image, a copy command should be used.

REF: https://docs.docker.com/reference/builder/#add
• If is a local tar archive in a recognized compression format (identity, gzip, bzip2 or xz) then it is unpacked as a directory. Resources from remote URLs are not decompressed. When a directory is copied or unpacked, it has the same behavior as tar -x: the result is the union of:

  1. Whatever existed at the destination path and
  2. The contents of the source tree, with conflicts resolved in favor of “2.” on a file-by-file basis.

REF: http://stackoverflow.com/questions/24958140/docker-copy-vs-add

You should check the ADDhttp://docs.docker.com/reference/builder/#add and COPYhttp://docs.docker.com/reference/builder/#copy documentations for an exhaustive description of their behaviours, but in a nutshell the major difference is that ADD can do more than COPY:

  • ADD allows to be an URL
  • If the parameter of ADD is an archive in a recognised compression format, it will be unpacked

Chris Snider
Senior Software Engineer
Intelligent Software Solutions, Inc.
[Description: Description: Description: cid:[email protected]]

From: David Xia [mailto:[email protected]]
Sent: Wednesday, August 12, 2015 7:48 AM
To: spotify/docker-maven-plugin [email protected]
Subject: Re: [docker-maven-plugin] ADD command incorrect for tar.gz files (#123)

@aburnetthttps://github.com/aburnett So the Dockerfile command should be ADD /opt/apps/spar-api.tar.gz /opt/apps/?


Reply to this email directly or view it on GitHubhttps://github.com//issues/123#issuecomment-130312306.

from docker-maven-plugin.

davidxia avatar davidxia commented on July 23, 2024

Yea I saw that. I think we all agree that ADD unpacks tar archives. The question is whether this plugin should be smart about tar files and instead of naively writing ADD /opt/apps/spar-api.tar.gz /opt/apps/spar-api.tar.gz write ADD /opt/apps/spar-api.tar.gz /opt/apps/ instead so that the contents of the archive aren't nested in a misleadingly named parent folder.

from docker-maven-plugin.

aburnett avatar aburnett commented on July 23, 2024

@chris-snider that's correct about copy/add. I'm going for copy+unpack so ADD is correct.

@davidxia ya, that's what I think the command should be. Perhaps the easiest solution is to just pass targetPath verbatim as the last argument to ADD. Then the behavior would match the docs and you wouldn't have to get fancy in the plugin.

from docker-maven-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.