Skip to content

jliuold/docker-api-spring-boot

Repository files navigation

docker-api-spring-boot Travis CI codecov 中文

Both Docker and Spring Boot become more and more popular. So the docker-api-spring-boot-starter comes. It makes easy to start a Spring Boot project with Docker API.

  1. Docker API is a restful api to operate docker on network.
  2. Docker-java is one wrapper of the Docker API.
  3. Docker-client is another wrapper of the Docker API.

The starter wrappers the configuration of docker-java and docker-client. So just add the maven dependency of docker-java or docker-client to your project and code happily.

Usage

Maven dependency

Add it to your project's pom:

<dependency>
    <artifactId>docker-api-spring-boot-starter</artifactId>
    <groupId>top.shareall</groupId>
    <version>1.0-SNAPSHOT</version>
</dependency>

If you want to use docker-java in your project, add this to your project pom:

<dependency>
    <groupId>com.github.docker-java</groupId>
    <artifactId>docker-java</artifactId>
</dependency>

Or you want to use docker-client in your project:

<dependency>
    <groupId>com.spotify</groupId>
    <artifactId>docker-client</artifactId>
</dependency>

Warning

Because the docker-java's last release has a error about dependency. So you must ensure your project can download snapshot version.

How to enable snapshot version

If you want to enable snapshot version with a maven repo mirror without snapshot. You can configure maven like below.

Use Huawei maven repo: Add below to maven setting file's servers node.

<server>
    <id>huaweicloud</id>
    <username>anonymous</username>
    <password>devcloud</password>
</server>

Add below to maven setting file's mirrors node.

<mirror>
    <id>huaweicloud</id>
    <mirrorOf>*,!snapshots</mirrorOf>
    <url>https://repo.huaweicloud.com/repository/maven/</url>
</mirror>

The snapshots repository is defined in the pom.xml of the starter.

Configuration

You can config docker-java in your spring-boot configuration. If you use deafault, of course you needn't to config it. A spring-boot configuration like this;

...
docker-java:
  dockerHost: unix://localhost
...

License

Docker-java-spring-boot is Open Source software released under the Apache 2.0 license.

Releases

No releases published

Packages

No packages published

Languages