1

I have a visual studio .pubxml for publish into a custom docker container with a dockerfile.

It's working well, the build generates the image and then the push is done correctly.

The problem is that I need to change the image name to push, by default it takes the project name.

<Project>
<PropertyGroup>
    <WebPublishMethod>Custom</WebPublishMethod>
    <DockerPublish>true</DockerPublish>
    <RegistryUrl>https://myUrl</RegistryUrl>
    <UserName>XXXXX</UserName>
    <PublishImageTag>latest</PublishImageTag>
    <PublishProvider>ContainerRegistry</PublishProvider>
    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <_TargetId>DockerCustomContainerRegistry</_TargetId>
    <!--<DockerfileBuildArguments>-t NEWNAME</DockerfileBuildArguments>-->
    <DockerfileTag>NEWNAME</DockerfileTag>
</PropertyGroup>

This is my .pubxml, with the DockerfileBuildArguments -t NEWNAME or with the DockerfileTag NEWNAME. The image that is generated is correct. But when visual studio try to do the push is still searching for the old named image (that is not generated now)

docker push PROJECTNAME:latest

But I want visual studio to do

docker push NEWNAME:latest

and I'm getting this error cause the image with the PROJECTNAME is not generated now:

Microsoft.WebTools.Azure.Publish.Docker.DockerCommandException: Running the docker.exe tag command failed.
Error response from daemon: No such image: PROJECTNAME:latest

Any ideas of how I can change that?

Thanks!

1 Answers1

1

<DockerfileTag>NEWNAME</DockerfileTag> needs to go into the project file not the publish profile.