
library/mavenMaintained by:
Carlos Sanchez
Where to get help:
the Docker Community Slack, Server Fault, Unix & Linux, or Stack Overflow
Dockerfile links3.9.12-eclipse-temurin-11-alpine, 3.9-eclipse-temurin-11-alpine, 3-eclipse-temurin-11-alpine
3.9.12-eclipse-temurin-11-noble, 3.9.12-eclipse-temurin-11, 3.9-eclipse-temurin-11-noble, 3.9-eclipse-temurin-11, 3-eclipse-temurin-11-noble, 3-eclipse-temurin-11
3.9.12-eclipse-temurin-17-alpine, 3.9-eclipse-temurin-17-alpine, 3-eclipse-temurin-17-alpine
4.0.0-rc-5-eclipse-temurin-17-alpine
3.9.12-eclipse-temurin-17-noble, 3.9.12-eclipse-temurin-17, 3.9-eclipse-temurin-17-noble, 3.9-eclipse-temurin-17, 3-eclipse-temurin-17-noble, 3-eclipse-temurin-17
4.0.0-rc-5-eclipse-temurin-17-noble, 4.0.0-rc-5-eclipse-temurin-17
3.9.12-eclipse-temurin-21-alpine, 3.9-eclipse-temurin-21-alpine, 3-eclipse-temurin-21-alpine
4.0.0-rc-5-eclipse-temurin-21-alpine
3.9.12-eclipse-temurin-21-noble, 3.9.12-eclipse-temurin-21, 3.9-eclipse-temurin-21-noble, 3.9-eclipse-temurin-21, 3-eclipse-temurin-21-noble, 3-eclipse-temurin-21
4.0.0-rc-5-eclipse-temurin-21-noble, 4.0.0-rc-5-eclipse-temurin-21
3.9.12-eclipse-temurin-25-alpine, 3.9-eclipse-temurin-25-alpine, 3-eclipse-temurin-25-alpine
4.0.0-rc-5-eclipse-temurin-25-alpine
3.9.12-eclipse-temurin-25-noble, 3.9.12, 3.9.12-eclipse-temurin, 3.9.12-eclipse-temurin-25, 3.9-eclipse-temurin-25-noble, 3.9, 3.9-eclipse-temurin, 3.9-eclipse-temurin-25, 3-eclipse-temurin-25-noble, 3, latest, 3-eclipse-temurin, eclipse-temurin, 3-eclipse-temurin-25
4.0.0-rc-5-eclipse-temurin-25-noble, 4.0.0-rc-5, 4.0.0-rc-5-eclipse-temurin, 4.0.0-rc-5-eclipse-temurin-25
3.9.12-eclipse-temurin-8-alpine, 3.9-eclipse-temurin-8-alpine, 3-eclipse-temurin-8-alpine
3.9.12-eclipse-temurin-8-noble, 3.9.12-eclipse-temurin-8, 3.9-eclipse-temurin-8-noble, 3.9-eclipse-temurin-8, 3-eclipse-temurin-8-noble, 3-eclipse-temurin-8
3.9.12-ibmjava-8, 3.9.12-ibmjava, 3.9-ibmjava-8, 3.9-ibmjava, 3-ibmjava-8, 3-ibmjava, ibmjava
3.9.12-ibm-semeru-11-noble, 3.9-ibm-semeru-11-noble, 3-ibm-semeru-11-noble
3.9.12-ibm-semeru-17-noble, 3.9-ibm-semeru-17-noble, 3-ibm-semeru-17-noble
4.0.0-rc-5-ibm-semeru-17-noble
3.9.12-ibm-semeru-21-noble, 3.9-ibm-semeru-21-noble, 3-ibm-semeru-21-noble
4.0.0-rc-5-ibm-semeru-21-noble
3.9.12-ibm-semeru-25-noble, 3.9-ibm-semeru-25-noble, 3-ibm-semeru-25-noble
4.0.0-rc-5-ibm-semeru-25-noble
3.9.12-amazoncorretto-11, 3.9-amazoncorretto-11, 3-amazoncorretto-11
3.9.12-amazoncorretto-11-al2023, 3.9-amazoncorretto-11-al2023, 3-amazoncorretto-11-al2023
3.9.12-amazoncorretto-11-alpine, 3.9-amazoncorretto-11-alpine, 3-amazoncorretto-11-alpine
3.9.12-amazoncorretto-11-debian, 3.9.12-amazoncorretto-11-debian-trixie, 3.9-amazoncorretto-11-debian, 3.9-amazoncorretto-11-debian-trixie, 3-amazoncorretto-11-debian, 3-amazoncorretto-11-debian-trixie
3.9.12-amazoncorretto-17, 3.9-amazoncorretto-17, 3-amazoncorretto-17
3.9.12-amazoncorretto-17-al2023, 3.9-amazoncorretto-17-al2023, 3-amazoncorretto-17-al2023
4.0.0-rc-5-amazoncorretto-17-al2023
3.9.12-amazoncorretto-17-alpine, 3.9-amazoncorretto-17-alpine, 3-amazoncorretto-17-alpine
3.9.12-amazoncorretto-17-debian, 3.9.12-amazoncorretto-17-debian-trixie, 3.9-amazoncorretto-17-debian, 3.9-amazoncorretto-17-debian-trixie, 3-amazoncorretto-17-debian, 3-amazoncorretto-17-debian-trixie
4.0.0-rc-5-amazoncorretto-17-debian, 4.0.0-rc-5-amazoncorretto-17-debian-trixie
4.0.0-rc-5-amazoncorretto-17
3.9.12-amazoncorretto-21, 3.9-amazoncorretto-21, 3-amazoncorretto-21
3.9.12-amazoncorretto-21-al2023, 3.9-amazoncorretto-21-al2023, 3-amazoncorretto-21-al2023
4.0.0-rc-5-amazoncorretto-21-al2023
3.9.12-amazoncorretto-21-alpine, 3.9-amazoncorretto-21-alpine, 3-amazoncorretto-21-alpine
3.9.12-amazoncorretto-21-debian, 3.9.12-amazoncorretto-21-debian-trixie, 3.9-amazoncorretto-21-debian, 3.9-amazoncorretto-21-debian-trixie, 3-amazoncorretto-21-debian, 3-amazoncorretto-21-debian-trixie
4.0.0-rc-5-amazoncorretto-21-debian, 4.0.0-rc-5-amazoncorretto-21-debian-trixie
4.0.0-rc-5-amazoncorretto-21
3.9.12-amazoncorretto-25, 3.9.12-amazoncorretto, 3.9-amazoncorretto-25, 3.9-amazoncorretto, 3-amazoncorretto-25, 3-amazoncorretto, amazoncorretto
3.9.12-amazoncorretto-25-al2023, 3.9-amazoncorretto-25-al2023, 3-amazoncorretto-25-al2023
4.0.0-rc-5-amazoncorretto-25-al2023
3.9.12-amazoncorretto-25-alpine, 3.9-amazoncorretto-25-alpine, 3-amazoncorretto-25-alpine
3.9.12-amazoncorretto-25-debian, 3.9.12-amazoncorretto-25-debian-trixie, 3.9-amazoncorretto-25-debian, 3.9-amazoncorretto-25-debian-trixie, 3-amazoncorretto-25-debian, 3-amazoncorretto-25-debian-trixie
4.0.0-rc-5-amazoncorretto-25-debian, 4.0.0-rc-5-amazoncorretto-25-debian-trixie
4.0.0-rc-5-amazoncorretto-25, 4.0.0-rc-5-amazoncorretto
3.9.12-amazoncorretto-8, 3.9-amazoncorretto-8, 3-amazoncorretto-8
3.9.12-amazoncorretto-8-al2023, 3.9-amazoncorretto-8-al2023, 3-amazoncorretto-8-al2023
3.9.12-amazoncorretto-8-alpine, 3.9-amazoncorretto-8-alpine, 3-amazoncorretto-8-alpine
3.9.12-amazoncorretto-8-debian, 3.9.12-amazoncorretto-8-debian-trixie, 3.9-amazoncorretto-8-debian, 3.9-amazoncorretto-8-debian-trixie, 3-amazoncorretto-8-debian, 3-amazoncorretto-8-debian-trixie
3.9.12-sapmachine-11, 3.9-sapmachine-11, 3-sapmachine-11
3.9.12-sapmachine-17, 3.9-sapmachine-17, 3-sapmachine-17
4.0.0-rc-5-sapmachine-17
3.9.12-sapmachine-21, 3.9-sapmachine-21, 3-sapmachine-21
4.0.0-rc-5-sapmachine-21
3.9.12-sapmachine-25, 3.9.12-sapmachine, 3.9-sapmachine-25, 3.9-sapmachine, 3-sapmachine-25, 3-sapmachine, sapmachine
4.0.0-rc-5-sapmachine-25, 4.0.0-rc-5-sapmachine
Where to file issues:
[***]
Supported architectures: (more info)
amd64, arm32v7, arm64v8, ppc64le, riscv64, s390x
Published image artifact details:
repo-info repo's repos/maven/ directory (history)
(image metadata, transfer size, etc)
Image updates:
official-images repo's library/maven label
official-images repo's library/maven file (history)
Source of this description:
docs repo's maven/ directory (history)
Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information.
!logo
You can run a Maven project by using the Maven Docker image directly, passing a Maven command to docker run:
console$ docker run -it --rm --name my-maven-project -v "$(pwd)":/usr/src/mymaven -w /usr/src/mymaven maven:3.3-jdk-8 mvn clean install
This is a base image that you can extend, so it has the bare minimum packages needed. If you add custom package(s) to the Dockerfile, then you can build your local Docker image like this:
console$ docker build --tag my_local_maven:3.5.2-jdk-8 .
The local Maven repository can be reused across containers by creating a volume and mounting it in /root/.m2.
console$ docker volume create --name maven-repo $ docker run -it -v maven-repo:/root/.m2 maven mvn archetype:generate # will download artifacts $ docker run -it -v maven-repo:/root/.m2 maven mvn archetype:generate # will reuse downloaded artifacts
Or you can just use your home .m2 cache directory that you share e.g. with your Eclipse/IDEA:
console$ docker run -it --rm -v "$PWD":/usr/src/mymaven -v "$HOME/.m2":/root/.m2 -v "$PWD/target:/usr/src/mymaven/target" -w /usr/src/mymaven maven mvn clean package
The $MAVEN_CONFIG dir (default to /root/.m2) could be configured as a volume so anything copied there in a Dockerfile at build time is lost. For that reason the dir /usr/share/maven/ref/ exists, and anything in that directory will be copied on container startup to $MAVEN_CONFIG.
To create a pre-packaged repository, create a pom.xml with the dependencies you need and use this in your Dockerfile. /usr/share/maven/ref/settings-docker.xml is a settings file that changes the local repository to /usr/share/maven/ref/repository, but you can use your own settings file as long as it uses /usr/share/maven/ref/repository as local repo.
dockerfileCOPY pom.xml /tmp/pom.xml RUN mvn -B -f /tmp/pom.xml -s /usr/share/maven/ref/settings-docker.xml dependency:resolve
To add your custom settings.xml file to the image use
dockerfileCOPY settings.xml /usr/share/maven/ref/
For an example, check the tests dir
Maven needs the user home to download artifacts to, and if the user does not exist in the image an extra user.home Java property needs to be set.
For example, to run as user 1000 mounting the host' Maven repo
console$ docker run -v ~/.m2:/var/maven/.m2 -ti --rm -u 1000 -e MAVEN_CONFIG=/var/maven/.m2 maven mvn -Duser.home=/var/maven archetype:generate
The maven images come in many flavors, each designed for a specific use case.
maven:<version>This is the defacto image. If you are unsure about what your needs are, you probably want to use this one. It is designed to be used both as a throw away container (mount your source code and start the container to start your app), as well as the base to build other images off of.
Some of these tags may have names like trixie in them. These are the suite code names for releases of Debian and indicate which release the image is based on. If your image needs to install any additional packages beyond what comes with the image, you'll likely want to specify one of these explicitly to minimize breakage when there are new releases of Debian.
Some of these tags may have names like noble in them. These are the suite code names for releases of Ubuntu and indicate which release the image is based on. If your image needs to install any additional packages beyond what comes with the image, you'll likely want to specify one of these explicitly to minimize breakage when there are new releases of Ubuntu.
maven:<version>-alpineThis image is based on the popular Alpine Linux project, available in the alpine official image. Alpine Linux is much smaller than most distribution base images (~5MB), and thus leads to much slimmer images in general.
This variant is useful when final image size being as small as possible is your primary concern. The main caveat to note is that it does use musl libc instead of glibc and friends, so software will often run into issues depending on the depth of their libc requirements/assumptions. See this Hacker News comment thread for more discussion of the issues that might arise and some pro/con comparisons of using Alpine-based images.
To minimize image size, it's uncommon for additional related tools (such as git or bash) to be included in Alpine-based images. Using this image as a base, add the things you need in your own Dockerfile (see the alpine image description for examples of how to install packages if you are unfamiliar).
View license information for the software contained in this image.
As with all Docker images, these likely also contain other software which may be under other licenses (such as Bash, etc from the base distribution, along with any direct or indirect dependencies of the primary software being contained).
Some additional license information which was able to be auto-detected might be found in the repo-info repository's maven/ directory.
As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within.
探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
在 Linux 系统配置镜像服务
在 Docker Desktop 配置镜像
Docker Compose 项目配置
Kubernetes 集群配置 Containerd
K3s 轻量级 Kubernetes 镜像加速
在宝塔面板一键配置镜像
Synology 群晖 NAS 配置
飞牛 fnOS 系统配置镜像
极空间 NAS 系统配置服务
爱快 iKuai 路由系统配置
绿联 NAS 系统配置镜像
QNAP 威联通 NAS 配置
Podman 容器引擎配置
HPC 科学计算容器配置
ghcr、Quay、nvcr 等镜像仓库
无需登录使用专属域名
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
免费版仅支持 Docker Hub 访问,不承诺可用性和速度;专业版支持更多镜像源,保证可用性和稳定速度,提供优先客服响应。
专业版支持 docker.io、gcr.io、ghcr.io、registry.k8s.io、nvcr.io、quay.io、mcr.microsoft.com、docker.elastic.co 等;免费版仅支持 docker.io。
当返回 402 Payment Required 错误时,表示流量已耗尽,需要充值流量包以恢复服务。
通常由 Docker 版本过低导致,需要升级到 20.x 或更高版本以支持 V2 协议。
先检查 Docker 版本,版本过低则升级;版本正常则验证镜像信息是否正确。
使用 docker tag 命令为镜像打上新标签,去掉域名前缀,使镜像名称更简洁。
来自真实用户的反馈,见证轩辕镜像的优质服务