spotify/docker-maven-plugin được TopGit xếp vào nhóm công cụ cho lập trình viên, với 2.6k sao trên GitHub, viết chủ yếu bằng Java. INACTIVE: A maven plugin for Docker
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
A Maven plugin for building and pushing Docker images.
Status: inactive
We recommend you use dockerfile-maven instead.
The future of docker-maven-plugin
This plugin was the initial Maven plugin used at Spotify for building Docker
images out of Java services. It was initially created in 2014 when we first
began experimenting with Docker. This plugin is capable of generating a
Dockerfile for you based on configuration in the pom.xml file for things like
the FROM image, resources to add with ADD/COPY, etc.
Over time at Spotify we have realized that the simplest way to build a Docker
image from a Java project is to have the developer write the Dockerfile. The
behavior of this plugin around generating Dockerfiles, copying your project
directory to a "staging" directory to use as the Docker build context, etc.,
ultimately led to a lot of unnecessary confusion with our users that stemmed
from introducing extra abstractions and a need for configuration on top of what
Docker is providing.
This led to the creation of a second Maven plugin for building docker images,
dockerfile-maven, which we think offers a simpler mental model of working
with Docker from Maven, for all of the reasons outlined in dockerfile-maven's
README.
The future of docker-maven-plugin
Purpose
Setup
Specify build info in the POM
Use a Dockerfile
Usage
Bind Docker commands to Maven phases
Using with Private Registries
Authentication
Using encrypted passwords for authentication
Testing
Releasing
Known Issues
Purpose
You can use this plugin to create a Docker image with artifacts built from your Maven project. For
example, the build process for a Java service can output a Docker image that runs the service.
Setup
You can specify the base image, entry point, cmd, maintainer and files you want to add to your
image directly in the pom, without needing a separate Dockerfile.
If you need VOLUME command(or any other not supported dockerfile command), then you will need
to create a Dockerfile and use the dockerDirectory element.
By default the plugin will try to connect to docker on localhost:2375. Set the DOCKER_HOST
environment variable to connect elsewhere.
DOCKER_HOST=tcp://<host>:2375
Other docker-standard environment variables are honored too such as TLS and certificates.
Specify build info in the POM
This example creates a new image named example, copies the project's jar file into the image,
and sets an entrypoint which runs the jar. Change VERSION GOES HERE to the latest tagged version.
<build>
<plugins>
...
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>VERSION GOES HERE</version>
<configuration>
<imageName>example</imageName>
<baseImage>java</baseImage>
<entryPoint>["java", "-jar", "/${project.build.finalName}.jar"]</entryPoint>
<!-- copy the service's jar file from target into the root directory of the image -->
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
</configuration>
</plugin>
...
</plugins>
</build>
Use a Dockerfile
To use a Dockerfile, you must specify the dockerDirectory element. If specified, the
baseImage, maintainer, cmd and entryPoint elements will be ignored. The contents of the
dockerDirectory will be copied into ${project.build.directory}/docker. Use the resources
element to copy additional files, such as the service's jar file.
You can also bind the build, tag & push goals to the Maven phases, so the container will be built, tagged and pushed
when you run just mvn deploy. If you have a multi-module project where a sub-module builds an image, you
will need to do this binding so the image gets built when maven is run from the parent project.
You can skip Docker goals bound to Maven phases with:
-DskipDockerBuild to skip image build
-DskipDockerTag to skip image tag
-DskipDockerPush to skip image push
-DskipDocker to skip any Docker goals
To remove the image named foobar run the following command:
mvn docker:removeImage -DimageName=foobar
For a complete list of configuration options run:
mvn com.spotify:docker-maven-plugin:<version>:help -Ddetail=true
Using with Private Registries
To push an image to a private registry, Docker requires that the image tag
being pushed is prefixed with the hostname and port of the registry. For
example to push my-image to registry.example.com, the image needs to be
tagged as registry.example.com/my-image.
The simplest way to do this with docker-maven-plugin is to put the registry
name in the <imageName> field, for example
Then when pushing the image with either docker:build -DpushImage or
docker:push, the docker daemon will push to registry.example.com.
Alternatively, if you wish to use a short name in docker:build you can use
docker:tag -DpushImage to tag the just-built image with the full registry
hostname and push it. It's important to use the pushImage flag as using
docker:push independently will attempt to push the original image.
Since version 1.0.0, the docker-maven-plugin will automatically use any
authentication present in the docker-cli configuration file at ~/.dockercfg
or ~/.docker/config.json, without the need to configure anything (in earlier
versions of the plugin this behavior had to be enabled with
<useConfigFile>true</useConfigFile>, but now it is always active).
Additionally the plugin will enable support for Google Container Registry if it
is able to successfully load Google's "Application Default Credentials".
The plugin will also load Google credentials from the file pointed to by the
environment variable DOCKER_GOOGLE_CREDENTIALS if it is defined. Since GCR
authentication requires retrieving short-lived access codes for the given
credentials, support for this registry is baked into the underlying
docker-client rather than having to first populate the docker config file
before running the plugin.
Lastly, authentication credentials can be explicitly configured in your pom.xml
and in your Maven installation's settings.xml file as part of the
<servers></servers> block.
Make sure Docker daemon is running and that you can do docker ps. Then run mvn clean test.
Releasing
Commits to the master branch will trigger our continuous integration agent to build the jar and
release by uploading to Sonatype. If you are a project maintainer with the necessary credentials,
you can also build and release locally by running the below.
Exception caught: system properties: docker has type STRING rather than OBJECT
Because the plugin uses Maven properties named like
docker.build.defaultProfile, if you declare any other Maven property with the
name docker you will get a rather strange-looking error from Maven:
[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.0.21:build (default) on project <....>:
Exception caught: system properties: docker has type STRING rather than OBJECT
To fix this, rename the docker property in your pom.xml.
InternalServerErrorException: HTTP 500 Internal Server Error
Problem: when building the Docker image, Maven outputs an exception with a
stacktrace like:
Caused by: com.spotify.docker.client.shaded.javax.ws.rs.InternalServerErrorException: HTTP 500 Internal Server Error
docker-maven-plugin communicates with your local Docker daemon using the HTTP
Remote API and any unexpected errors that the daemon encounters will be
reported as 500 Internal Server Error.
Check the Docker daemon log (typically at /var/log/docker.log or
/var/log/upstart/docker.log) for more details.
Invalid repository name ... only [a-z0-9-_.] are allowed
One common cause of 500 Internal Server Error is attempting to build an image
with a repository name containing uppercase characters, such as if the
<imageName> in the plugin's configuration refers to ${project.version} when
the Maven project version is ending in SNAPSHOT.
Consider putting the project version in an image tag (instead of repository
name) with the <dockerImageTags> configuration option instead.
spotify/docker-maven-plugin thuộc nhóm Developer Tools trên TopGit, cùng 4 topic GitHub. Trang Trending và Topics liệt kê các repo cùng số sao và cùng ngôn ngữ để so sánh.
Đọc thêm về spotify/docker-maven-plugin ở đâu?
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/spotify/docker-maven-plugin là nguồn chính thức.
spotify/docker-maven-plugin có bao nhiêu sao?
spotify/docker-maven-plugin có 2.6k sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/spotify/docker-maven-plugin. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
spotify/docker-maven-plugin có phải mã nguồn mở không?
Có — spotify/docker-maven-plugin phát hành theo license Apache-2.0, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/spotify/docker-maven-plugin.
spotify/docker-maven-plugin còn đang phát triển không?
Commit gần nhất trên spotify/docker-maven-plugin là 4.9 năm trước (theo timestamp GitHub). Repo có 557 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
spotify/docker-maven-plugin dùng license gì?
spotify/docker-maven-plugin phát hành theo license Apache-2.0. Nên mở file LICENSE trên GitHub để xác nhận — license metadata đôi khi lệch với thực tế dự án.
spotify/docker-maven-plugin là gì?
spotify/docker-maven-plugin (spotify/docker-maven-plugin) là dự án Java trên GitHub. Theo mô tả gốc: INACTIVE: A maven plugin for Docker
spotify/docker-maven-plugin viết bằng ngôn ngữ gì?
spotify/docker-maven-plugin chủ yếu viết bằng Java. Trường "language" của GitHub dựa trên phần lớn byte ở nhánh mặc định.
Đọc đầy đủ README ở tab phía trên.
Vẫn đang phân vân về docker-maven-plugin?
Một cú bấm sẽ gửi câu hỏi kèm trang này cho AI — xem AI nói gì về docker-maven-plugin.