Skip to content

Commit 6f6c329

Browse files
authored
fix: add Docker Hub login before building image (#29)
# Motivation The Docker image build is failing with authentication error: ``` 401 Unauthorized {"details":"access token has insufficient scopes"} ``` This prevents the Docker image from being published to Docker Hub. # Description ## Root Cause The Jib Maven plugin needs Docker Hub credentials to push images. It was trying to use credentials from the Docker config file (`~/.docker/config.json`), but this file didn't exist or didn't have valid credentials. The error message indicates that Jib couldn't authenticate: ``` Build image failed, perhaps you should make sure your credentials for 'registry-1.docker.io/dockerhubaneo/armonik-dynamic-java-worker' are set up correctly ``` ## Solution Add an explicit Docker login step before building the image: ```yaml - name: Log in to Docker Hub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_HUB_LOGIN }} password: ${{ secrets.DOCKER_HUB_TOKEN }} ``` This creates credentials in `~/.docker/config.json` that Jib automatically reads when pushing images.
2 parents ec41a56 + 3092d78 commit 6f6c329

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

.github/workflows/release.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,16 +133,19 @@ jobs:
133133
java-version: '17'
134134
cache: maven
135135

136+
- name: Log in to Docker Hub
137+
uses: docker/login-action@v3
138+
with:
139+
username: ${{ secrets.DOCKER_HUB_LOGIN }}
140+
password: ${{ secrets.DOCKER_HUB_TOKEN }}
141+
136142
- name: Set project version
137143
working-directory: worker
138144
run: ./mvnw -B -ntp versions:set -DnewVersion=${{ needs.extract-version.outputs.version }} -DprocessAllModules=true -DgenerateBackupPoms=false
139145

140146
- name: Build and push Docker image
141147
working-directory: worker
142148
run: ./mvnw -B -ntp clean package -Pdocker
143-
env:
144-
DOCKER_USERNAME: ${{ secrets.DOCKER_HUB_LOGIN }}
145-
DOCKER_PASSWORD: ${{ secrets.DOCKER_HUB_TOKEN }}
146149

147150
- name: Verify Docker image
148151
run: |

0 commit comments

Comments
 (0)