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.

Running a build with empty build args builds and pushes an image with no name

See original GitHub issue

Description

I recently ran this action in a workflow, with my repo name nicely lowercased (docker/build-push-action#37), but had one of my build args configured incorrectly. Note the environment variable BUILD_env=test, which should have been BUILD_ENV=test. My Dockerfile has default build args set (like ARG BUILD_ENV=development), but the build arg here was probably overwriting that. My bad.

However, the action actually sets the image name to [], kicks off a Docker build, completes the build, and attempts to push an image named [].

Specific image name below replaced with org/repo/image.

Run docker/build-push-action@v1
  with:
    username: br3ndonland
    password: ***
    build_args: BUILD_ENV=
    registry: docker.pkg.github.com
    repository: org/repo/image
    tag_with_ref: false
    tag_with_sha: false
    path: .
    always_pull: false
    add_git_labels: false
    push: true
  env:
    DOCKER_REPO: org/repo
    BUILD_env: test

...

Logging in to registry docker.pkg.github.com

Login Succeeded
Building image []
Sending build context to Docker daemon  301.6kB

...

Removing intermediate container c6704dceaa3b
---> 2a565e64a9ba
Successfully built 2a565e64a9ba
Pushing image []

Suggestions

  • The action should correctly read image names.
  • If the action doesn’t receive a name, it should stop and throw an error, rather than going through the entire build and push process.

Related

docker/build-push-action#37 docker/build-push-action#41

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

0reactions
mickel8commented, Oct 21, 2021

Is there an example for defining Docker build-arg? I can’t see anything like this.

I wanted to do something like this --build-arg=VERSION=$(git describe) but can’t manage to include this in workflow

Read more comments on GitHub >

github_iconTop Results From Across the Web

docker build - Docker Documentation
The docker build command builds Docker images from a Dockerfile and a “context”. A build's context is the set of files located in...
Read more >
Docker, one or more build-args were not consumed
In simple Word, If you pass ARGs like --build-arg SOME_ARG=some_value to Docker build and did not declare the ARGS in Dockerfile this warning ......
Read more >
Six Ways to Build Docker Images Faster (Even in Seconds)
Using pre-built Docker images​​ Another way to solve the problem of a clear Docker cache is to move some of the layers to...
Read more >
Chapter 8. Builds OpenShift Container Platform 3.11
The destination must be a relative directory path. At build time, the image will be loaded and the indicated files and directories will...
Read more >
Docker Plugin — sbt-native-packager 1.9.0 documentation
The docker binary used by the build should already have been configured with the ... Builds an image using the local Docker server,...
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