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
Add Dockerfile instructions to reset properties inherited from parent image #8177
Conversation
fwiw, I think this is a good feature, but would rather have a 'RM' command that takes subcommands. Other than that new verbs are really solomon's call. |
Please adjust your tests to additionally address this scenario:
I don't see this and this will likely be a very common use case. |
5f808d9
to
8d10b90
Compare
+1 to that suggestion. Additional suggestion; I'd prefer |
UNSET communicates the intent better too, I agree. On Sep 23, 2014, at 1:22 PM, Sebastiaan van Stijn notifications@github.com wrote:
|
I guess the wait is now for solomon to return from holidays 😄 Thanks for the PR @dqminh nice (and welcome) feature! |
@erikh , @thaJeztah i agree that |
d2e29fa
to
a2aa2c0
Compare
@erikh i changed Regarding the addtional test:
I wrote a new test in dqminh@a2aa2c0. Is this what you want ? |
@dqminh I don't see how the test tests the functionality. I have additional comments in the line notes. Next steps:
Just so you know what the process is. |
and a step in between 1 and 2 - write the documentation for it. |
a2aa2c0
to
b9229db
Compare
@shykes Right now this is a pure UI change and adding dockerfile instructions. Please review at the next design session. |
Roger that. On Thursday, November 13, 2014, Michael Crosby notifications@github.com
|
Hi, sorry for the late review. As discussed in #3465, I agree with the idea. However may I request small changes in the syntax:
I know it's arbitrary (as UI decisions always are), but I feel that the extra keyword adds a cognitive burden without clear benefit. I'd rather have more total keywords, but less words on any given dockerfile. |
Small precision: only the design was reviewed, not the implementation yet. |
I can review the impl in a bit.
|
@@ -65,6 +65,11 @@ func Merge(userConf, imageConf *Config) error { | |||
} | |||
} | |||
} | |||
if len(userConf.RmExposedPorts) > 0 { |
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 would like to see these runconfig elements as separate functions. This function is extremely long and anything that goes towards making it simpler, I am all for.
Tests look good, but this needs a serious refactor because of the syntax changes. Please ping me if/when this arrives. Thanks! |
@dqminh Would you be available to rebase/update this PR based on the last feedback? Now that we have a go on design, we should be able to move forward with it. Thank you! |
It’s going to need a full redesign, the methods used there will not work for the new syntax. -Erik
|
Don’t close this one, he can just force push on top of it. -Erik
|
Thanks so much for the review guys ❤️ @erikh @icecrime afair there should not be too much changes ( it's essentially a revert of dqminh@63b3daf ). I can just force-push new changes to current branch. I should be able to work on this soonish. |
Thanks Daniel! -Erik
|
I have an usecase for UNEXPOSE Linking a container with exposed port to another one results some environment variables to be created on the container with information about exposed ports and environment. I'm using these variables with a tool to manage auto-configuration in containers, if there is an exposed port which is not actually used, my configuration will be corrupted 😞 There is no way to reset exposed port from a container, you can only add some but nothing to close one. So, I think that UNEXPOSE is an important feature. |
Use case for UNEXPOSE Suppose I have four docker hosts and I want to run 16 maven tomcat containers which all default to internal port 8080. Now imagine I'm using registrator with rancher CNI - which locks me down to the internal port. In this situation - docker's internal->external port mapping isn't enough to solve my problem. I actually need to override the internal port mapping, preferably without rebuilding the original container. |
You guys spent almost 4 years for talking about UI and command name? Really? |
Just today I needed to run a wordpress site and I faced the same problem, it declares a I wanted to include the content via a child image but could not... |
Excuse me, is this implemented or not? |
@ibc no it wasn't; see #3465 (comment) |
Thanks @thaJeztah - for us to do a pull request - could you please point to the line of code (in your point of view) for us to start reading. |
As in the dicussion of #3465 please note that there is a workaround available (using docker-copyedit). |
the UNSETENV or UNSET ENV can work now,how can I delete some base image's env when I build image |
+UNVOLUME |
Why was this closed due to no real world cases? This happens pretty often right? We build a bunch of docker images that use each other as base image. In one of the base images we set ENV CYPRESS_BINARY_VERSION because all our projects require this. But now we want to upgrade Cypress to a new version for one project at the time and this version requires CYPRESS_BINARY_VERSION to not exist... so we need to override this in one of the project docker images but not change the base image.. only UNSET does not exist! This was started in 2014, it could have been fixed in 2017, but still almost 2019 and not fixed? |
@Athaphian .... #3465 ist still open. (and you can use the workaround with docker-copyedit ) |
@gdraheim Im sure that will work, and we might eventually go that route too. But it is more tedious than just adding unsetenv in the dockerfile. |
+UNVOLUME |
Really need an UNVOLUME option. docker-copyedit is a clunky option. |
Sorry to "exhume" this wonderful PR, but clearly remove Or we should strongly discourage to use such properties in base image? (I am in trouble with the official image https://github.com/docker-library/docker/blob/65fab2cd767c10f22ee66afa919eda80dbdc8872/18.09/dind/Dockerfile#L40 that create a volume where Docker images are stored, in CI env, this is really unwanted). Thanks you |
Also have a use case for UNEXPOSE. Why is this marked closed? |
@icecrime Sorry to I ran in to this problem today using the official Postgres image with the TestContainers project (https://github.com/testcontainers/testcontainers-node), where my integration tests started generating volumes from the containers. It appears that the |
@dqminh Thanks, are these commands available now in Dockerfile?
|
+UNVOLUME |
I'm all for UNVOLUME which would be really helpful for a number of scenarios where all someone wants is to remove a volume from a base image and nothing else. |
Arguments in favor for adding UNVOLUME.
Therefore, in theory, the files of a child image will under no circumstances end up in parent default volume.
Please study the topic #3465 and you will understand that there are problems. It’s just that not everyone can or wants to describe the situation that the developers encountered. I think there are enough legal grounds to consider this problem seriously and include any option for canceling the parent default volume. |
My use case is https://github.com/docker-library/wordpress/blob/master/latest/php8.1/fpm/Dockerfile#L151 where I want to add a customized wordpress install directly to a downstream image but I have to resort to copying the entire file, just to remove that I saw that you can use |
Sorry, but I'm locking the conversation on this PR; this PR is 10 years old, including decisions made 10 Years ago. The Dockerfile syntax and Builder is no longer maintainer in this repository, and now maintained by the BuildKit project (https://github.com/moby/buildkit), which is where features like this can be implemented. While this original PR was rejected, the ticked related to this PR was reopened, but the overall design may need discussion. Also note that some of the use-cases ( This comment #3465 (comment) is relevant here;
These things are best discussed in the BuildKit issue tracker, in which a design can be proposed. |
This is an attemp to fix #3465. I've been working on this yesterday and figure that the design can be reviewed at this stage.
New added instructions are:
UNSETENV ENV1 ENV2 ...
unset environment variables inherited from parent imageUNEXPOSE PORT ...
remove exposed ports inherited from parent imageNOVOLUME PATH
remove volume mountpoints from parent image