Jib Maven Plugin: 401 Unauthorized Error When Pushing Docker Image to Docker Hub

I cannot push a Docker image using the Jib Maven Plugin. I’m repeatedly getting a 401 Unauthorized error. I have not changed much, but the day before I got a 416 error. Here’s a quick summary of the problem:

Error message when using:

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.3.3</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <groupId>org.example</groupId>
    <artifactId>korfballteamapi</artifactId>
    <version>0.0.1</version>
    <name>KorfballTeamAPI</name>
    <description>KorfballTeamAPI</description>

    <organization>
        <name>GlasgowKorfball</name>
        <url>https://GlasgowKorfball.com</url>
    </organization>

    <properties>
        <java.version>22</java.version>
        <maven.compiler.source>22</maven.compiler.source>
        <maven.compiler.target>22</maven.compiler.target>
        <docker.username>rsmithuchot1</docker.username>
        <start-class>org.example.korfballteamapi.KorfballTeamApiApplication</start-class>
    </properties>

    ....Rest of POM

    <build>
        <plugins>
            ... rest of plugins
            <plugin>
                <groupId>com.google.cloud.tools</groupId>
                <artifactId>jib-maven-plugin</artifactId>
                <version>3.4.3</version>
                <configuration>
                    <from>
                        <image>eclipse-temurin:22</image>
                        <platforms>
                            <platform>
                                <architecture>arm64</architecture>
                                <os>linux</os>
                            </platform>
                            <platform>
                                <architecture>amd64</architecture>
                                <os>linux</os>
                            </platform>
                        </platforms>
                    </from>
                    <to>
                        <image>docker.io/rsmithucot1/korfball-api</image>
                        <tags>
                            <tag>latest</tag>
                        </tags>
                    </to>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>build</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

Error message:

[ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:3.4.3:build (default) on project korfballteamapi: Build image failed, perhaps you should make sure your credentials for ‘registry-1.docker.io/thisisanewimage’ are set up correctly. See https://github.com/GoogleContainerTools/jib/blob/master/docs/faq.md#what-should-i-do-when-the-registry-responds-with-unauthorized for help: Unauthorized for registry-1.docker.io/thisisanewimage: 401 Unauthorized.
[ERROR] HEAD https://registry-1.docker.io/v2/thisisanewimage/blobs/sha256:0806d5dbd9524f498cca7b9bea84c32bef6050eb04603092302d155b92fb411e

Error message when using:


    <organization>
        <name>GlasgowKorfball</name>
        <url>https://GlasgowKorfball.com</url>
    </organization>

    <properties>
        <java.version>22</java.version>
        <maven.compiler.source>22</maven.compiler.source>
        <maven.compiler.target>22</maven.compiler.target>
        <docker.username>rsmithuchot1</docker.username>
        <start-class>org.example.korfballteamapi.KorfballTeamApiApplication</start-class>
    </properties>
    enter code here

... rest of the POM

            <plugin>
                <groupId>com.google.cloud.tools</groupId>
                <artifactId>jib-maven-plugin</artifactId>
                <version>3.4.3</version>
                <configuration>
                    <from>
                        <image>eclipse-temurin:22</image>
                        <platforms>
                            <platform>
                                <architecture>arm64</architecture>
                                <os>linux</os>
                            </platform>
                            <platform>
                                <architecture>amd64</architecture>
                                <os>linux</os>
                            </platform>
                        </platforms>
                    </from>
                    <to>
                        <image>docker.io/${docker.username}/${project.artifactId}:${project.version}</image>
                        <tags>
                            <tag>latest</tag>
                        </tags>
                    </to>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>build</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

Error message:

[ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:3.4.3:build (default) on project korfballteamapi: 416 Requested Range Not Satisfiable
[ERROR] PATCH https://registry-1.docker.io/v2/rsmithuchot1/korfballteamapi/blobs/uploads/ecfb7fe9-bf7b-4705-a25e-f2c4f9125e43?_state=GViHxJxiULvlBx3YP1PH-1qcnMEZ7KsgxbHLYqqhK2J7Ik5hbWUiOiJyc21pdGh1Y2hvdDEva29yZmJhbGx0ZWFtYXBpIiwiVVVJRCI6ImVjZmI3ZmU5LWJmN2ItNDcwNS1hMjVlLWYyYzRmOTEyNWU0MyIsIk9mZnNldCI6MCwiU3RhcnRlZEF0IjoiMjAyNC0wOS0xMlQxMjowMDo1MC4wMDY1MDE1NTJaIn0%3D
[ERROR] {“errors”:[{“code”:”RANGE_INVALID”,”message”:”invalid content range”}]}

Credentials configuration:

Here is the relevant part of my config.json:

{
  "auths": {
    "https://index.docker.io/v1/": {
      "auth": "REDACTED_BASE64_ENCODED_CREDENTIALS"
    },
    "https://index.docker.io/v2/": {
      "auth": "REDACTED_BASE64_ENCODED_CREDENTIALS"
    }
  },
  "currentContext": "desktop-linux",
  "plugins": {
    "debug": {
      "hooks": "exec"
    },
    "scout": {
      "hooks": "pull,buildx build"
    }
  },
  "features": {
    "hooks": "true"
  }
}

What I’ve tried:

  1. Re-authenticated with Docker Hub: I used docker login to ensure my credentials are up-to-date.

  2. Verified credential encoding: The credentials appear to be base64-encoded correctly.

  3. Checked Docker Hub URL: Confirmed that the registry URL is correct.

  4. I downloaded and pushed an image: I downloaded a random image and pushed it to docker fine so that I can push from my command line.

Additional information:

  • Jib Maven Plugin Version: 3.4.3

  • Docker Config Location: C:Usersricha.dockerconfig.json

  • Image Name: thisisanewimage

  • Repository: “https://index.docker.io/v1/” or “https://index.docker.io/v2/”

Question:

What might be causing the 401 Unauthorized error when using Jib to push the Docker image or the 416 Request Range Not Satisfiable? Does it relate to when the image for the tumerin:22 is being pulled? Are there any specific issues with how credentials are managed or how Jib interacts with Docker Hub that I should be aware of? I do not understand why these credentials (the ones automatically generated by docker when logging in in the config file) are insufficient if I log in to the terminal to docker.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật