apache / apache/maven-mvnd

`.mavenrc` not honored

Open
#909 9 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
3.5k
Forks
250
Avg merge
16h 22m
Merged PRs (30d)
36

Description

I am using the Maven plugin `dockerfile-maven-plugin` to build a Docker image for a maven module.

To build the image I just run `mvn package`. I have to login to the company registry once with `docker login` before running the Maven build for the first time. After that I don't have to do anything anymore. `mvn package` is enough to build my image.

But that doesn't work with `mvnd package`:

```bash
[INFO] --- dockerfile:1.4.13:build (package) @ ---
[INFO] Google Container Registry support is disabled
[INFO] dockerfile: /target/Dockerfile
[INFO] contextDirectory: /
[INFO] Building Docker context /
[INFO] Path(dockerfile): //target/Dockerfile
[INFO] Path(contextDirectory): /
[INFO]
[INFO] Image will be built as //:
[INFO]
[INFO] Step 1/20 : FROM /eclipse-temurin:17.0.8_7-jre-alpine
[INFO]
[ERROR] Head "/eclipse-temurin/manifests/17.0.8_7-jre-alpine": unknown: Authentication is required
[WARNING] An attempt failed, will retry 1 more timesorg.apache.maven.plugin.MojoExecutionException: Could not build image

[omitted stack trace]

Failed to execute goal com.spotify:dockerfile-maven-plugin:1.4.13:build (package) on project Could not build image: Head "/eclipse-temurin/manifests/17.0.8_7-jre-alpine": unknown: Authentication is required -> [Help 1]
```

It looks a bit like, that `mvnd` doesn't use the local docker daemon to build the image

The problem sounds similar to https://github.com/apache/maven-mvnd/issues/157

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the difference between `mvn package` and `mvnd package` with `dockerfile-maven-plugin` 1.4.13 and a registry configured through `.mavenrc`. Trace how mvnd handles the Maven invocation and Docker authentication compared with mvn. Done means `mvnd package` honors the local Docker credentials and builds the image successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, java
Domain
build-system, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.