question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Push without latest

See original GitHub issue

This is a question. Is it possible to build an image, as a specific version (tag), then push it, without pushing latest?

This is what I’m having so far, and it pushes both a latest and a (substituted) ${project.version}.

<image>
    <name>company/${project.artifactId}</name>
    <alias>${project.artifactId}</alias>
    <registry>my.registry.host</registry>
    <build>
        <tags>
            <tag>${project.version}</tag>
        </tags>
        <from>java:8-jdk</from>
        ...
    </build>
</image>

I’ve tried setting the tag directly:

<name>company/${project.artifactId}:${project.version}</name>

But that just runs me into trouble:

[INFO] --- docker-maven-plugin:0.11.2:build (dockerize) @ artifactId ---
[INFO] DOCKER> Creating image [company/artifactId:1.0.8-SNAPSHOT] "artifactId"
[INFO] Copying files to E:\artifactId\provider\target\docker\company\artifactId\1.0.8-SNAPSHOT\build\maven
[INFO] Building tar: E:\artifactId\provider\target\docker\company\artifactId\1.0.8-SNAPSHOT\tmp\docker-build.tar
[INFO] DOCKER> Tagging image [company/artifactId:1.0.8-SNAPSHOT] "artifactId": 1.0.8-SNAPSHOT
[ERROR] DOCKER> could not find image: no such id: company/artifactId (Not Found: 404)

And:

[ERROR] Failed to execute goal org.jolokia:docker-maven-plugin:0.11.2:build (dockerize) on project artifactId: Unable to add tag [company/artifactId:1.0.8-SNAPSHOT] to image [company/artifactId:1.0.8-SNAPSHOT] -> [Help 1]

This may be a flaw yet into my understanding of Docker, but I’m trying to avoid latest to be pushed from every branch that is building this stuff, and we tend to represent the branches in the version name while in our CI environment. I am trying to avoid it in part because I think it has little meaning in my highly branched environment, but I’m also afraid for concurrency issues.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:26 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
rhusscommented, Sep 10, 2017

@MichalOrlowski just on a second though: You can always do a

                        <image>
                            <name>app-name:${project.version}</name>
                            <build>
                                <dockerFileDir>${project.basedir}/module_name</dockerFileDir>
                                <tags>
                                    <tag>${envTag}</tag>
                                </tags>
                            </build>
                        </image>

This would solve your use case, as the latest results only because you haven’'t specified a tag in the name. Thinking again thats a better solution then the one I proposed above, as it works already now and is sufficiently clean enough 😉

1reaction
mohnishkodnanicommented, Sep 26, 2017

I have the same problem. Where I have multiple tags in the configuration and the latest always get pushed. Due to this when multiple jobs are running simultaneously and because we have big images , they end up failing due to the latest tag being created from multiple branches. Image xyz:latest could be pushed, but the temporary tag could not be removed and then the build fails. I dont see this problem if I only have one job running.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Push git to remote (Github) only one last commit, without history?
The best approach is git rebase . You can delete the commits that you do not want to be pushed. You can also...
Read more >
Pushing commits to a remote repository - GitHub Docs
Use git push to push commits made on your local branch to a remote ... git push command, but you would add one...
Read more >
git-push Documentation - Git
This option allows you to say that you expect the history you are updating is what you rebased and want to replace. If...
Read more >
PyCharm - Commit and push changes to Git repository
If you want to append local changes to the latest commit instead of creating a separate commit, select the Amend option. Enter the...
Read more >
Push Options - GitLab Docs
Push options for GitLab CI/CD ; ci.skip, Do not create a CI pipeline for the latest push. Only skips branch pipelines and not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found