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

ImageFromDockerfileBuilder does not tag image #237

Closed
Jejuni opened this issue Apr 23, 2020 · 2 comments
Closed

ImageFromDockerfileBuilder does not tag image #237

Jejuni opened this issue Apr 23, 2020 · 2 comments
Labels
enhancement New feature or request
Milestone

Comments

@Jejuni
Copy link
Contributor

Jejuni commented Apr 23, 2020

Describe the bug
I have a Dockerfile which consists only of the following:

FROM rabbitmq:3.8-management-alpine

COPY rabbitmq_delayed_message_exchange* /plugins/

RUN rabbitmq-plugins enable rabbitmq_delayed_message_exchange

I have the delayed exchange plugin in the same folder as the dockerfile.

Using

var imgBuilder = new ImageFromDockerfileBuilder()
                .WithName("rabbitmqtest:custom")
                .WithDockerfileDirectory("docker/rabbitmq");
string img = await imgBuilder.Build();

I could not get the image to be tagged. It would always be none:none.
I noticed that when debugging and stopping in

using (var unused = await this.Docker.Images.BuildImageFromDockerfileAsync(stream, new ImageBuildParameters { Dockerfile = config.Dockerfile, Tags = new[] {config.Image.FullName } }, ct))
{
    // New Docker image built, ready to use.
}

and remaining there the image would be tagged.
It seemed to me that creation and tagging are two separate processes in BuildImageFromDockerfileAsync and if the stream is disposed to quickly the image will not get tagged.
That also explains why for very simple Dockerfile the tagging will succeed.

To Reproduce
Execute the code mentioned above in a unit test.

Expected behavior
The image should be tagged.

Solution
Reading the stream to the end delays further execution until the image is tagged.
I have provided a PR #238 but your build pipeline seems to be failing during an initial step unrelated to the PR.

@HofmeisterAn HofmeisterAn added the enhancement New feature or request label Apr 23, 2020
@HofmeisterAn HofmeisterAn added this to the 1.3.0 milestone Apr 23, 2020
@HofmeisterAn
Copy link
Collaborator

Included in #238 and published in 1.3.0-beta.20200423.2. If you need a proper release let me know.

@Jejuni
Copy link
Contributor Author

Jejuni commented Apr 24, 2020

The beta release will be fine.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants