{"id":13416516,"url":"https://github.com/gesellix/docker-client","last_synced_at":"2026-03-11T09:13:47.682Z","repository":{"id":16729052,"uuid":"19486213","full_name":"gesellix/docker-client","owner":"gesellix","description":"A Docker client for Java written in Kotlin and Groovy","archived":false,"fork":false,"pushed_at":"2025-03-26T16:28:07.000Z","size":4307,"stargazers_count":116,"open_issues_count":26,"forks_count":28,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-28T13:08:46.824Z","etag":null,"topics":["docker","docker-client","docker-compose","docker-daemon","docker-engine","engine-api","groovy","hacktoberfest","java"],"latest_commit_sha":null,"homepage":"https://www.gesellix.net","language":"Groovy","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gesellix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":"supported-api.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"gesellix","patreon":"gesellix"}},"created_at":"2014-05-06T08:06:20.000Z","updated_at":"2025-03-14T20:41:04.000Z","dependencies_parsed_at":"2023-10-12T03:13:39.412Z","dependency_job_id":"1d0380f7-ef1e-40fb-aabe-eade1618926d","html_url":"https://github.com/gesellix/docker-client","commit_stats":{"total_commits":1718,"total_committers":16,"mean_commits":107.375,"dds":0.3032596041909197,"last_synced_commit":"0bf6649d467929f5c2e1f8df787fc9734ed152bf"},"previous_names":[],"tags_count":49,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gesellix%2Fdocker-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gesellix%2Fdocker-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gesellix%2Fdocker-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gesellix%2Fdocker-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gesellix","download_url":"https://codeload.github.com/gesellix/docker-client/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247190250,"owners_count":20898702,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-client","docker-compose","docker-daemon","docker-engine","engine-api","groovy","hacktoberfest","java"],"created_at":"2024-07-30T21:01:00.036Z","updated_at":"2026-03-11T09:13:47.646Z","avatar_url":"https://github.com/gesellix.png","language":"Groovy","readme":"[![Build Status](https://img.shields.io/github/actions/workflow/status/gesellix/docker-client/cd.yml?branch=main\u0026style=for-the-badge)](https://github.com/gesellix/docker-client/actions)\n[![Maven Central](https://img.shields.io/maven-central/v/de.gesellix/docker-client.svg?style=for-the-badge\u0026maxAge=86400)](https://search.maven.org/search?q=g:de.gesellix%20AND%20a:docker-client)\n[![API Coverage](https://img.shields.io/static/v1?label=API%20Coverage%20(v1.31)\u0026message=104%2F122%20endpoints\u0026color=blue\u0026style=for-the-badge)](https://github.com/gesellix/docker-client/blob/master/supported-api.md)\n\n# Docker Client\n\nA Docker HTTP client for the Java VM written in Groovy\n\nThis client library aims at supporting all existing [Docker api endpoints](https://docs.docker.com/engine/api/),\n which effectively allows to use it in place of the official Docker client binary.\n\nSee the [supported-api.md](https://github.com/gesellix/docker-client/blob/master/supported-api.md)\n for details about the current api coverage.\n\nAll platforms are natively supported, which includes:\n- [Linux](https://docs.docker.com/engine/installation/linux/),\n- [Docker for Mac](https://docs.docker.com/docker-for-mac/),\n- [Docker for Windows](https://docs.docker.com/docker-for-windows/),\n- [Docker Machine](https://docs.docker.com/machine/overview/),\n- and the legacy [Docker Toolbox](https://docs.docker.com/toolbox/overview/).\n\nConsider the client as a thin wrapper to perform HTTP requests, minimizing the need to manually configure\n TLS or auth encoding in your code. Most commonly known environment variables will work as expected,\n e.g. `DOCKER_HOST`, `DOCKER_TLS_VERIFY`, or `DOCKER_CERT_PATH`.\n Due to its thin layer this client might feel a bit less convenient, though,\n while it gives you a bit more freedom to access the engine api and some less popular endpoints.\n\nThe client also includes [Docker Compose version 3](https://docs.docker.com/compose/compose-file/) support\n as part of the `docker stack --compose ...` command.\n See the [docker stack deploy docs](https://docs.docker.com/engine/reference/commandline/stack_deploy/) for details.\n Please note that you'll need at least Java 8 when using that feature.\n\n## Plain Usage\n\nFor use in Gradle, ensure that you declared Maven Central as repository:\n\n    repositories {\n      mavenCentral()\n    }\n\nThen, you need to add the dependency, but please ensure to use the [latest version](https://search.maven.org/artifact/de.gesellix/docker-client):\n\n    dependencies {\n      implementation(\"de.gesellix:docker-client:2021-02-20T21-57-11\")\n    }\n\nThe tests in `DockerClientImplSpec` and `DockerClientImplIntegrationSpec` should give you an idea how to use the docker-client.\n\nThe default Docker host is expected to be available at `unix:///var/run/docker.sock`.\n When using Docker Machine the existing environment variables as configured by `eval \"$(docker-machine env default)\"` should be enough.\n\nEven for the native packages [Docker for Mac](https://docs.docker.com/docker-for-mac/)\n and [Docker for Windows](https://docs.docker.com/docker-for-windows/) you'll be able to rely on the default configuration.\n For Mac the default is the same as for Linux at `unix:///var/run/docker.sock`, while\n Windows uses the named pipe at `//./pipe/docker_engine`.\n\nYou can override existing `DOCKER_*` environment variables with Java system properties like this:\n\n    System.setProperty(\"docker.host\", \"192.168.99.100\")\n    System.setProperty(\"docker.cert.path\", \"/Users/${System.getProperty('user.name')}/.docker/machine/machines/default\")\n\nPlease note that the raw responses (including headers) from the Docker daemon are returned, with the actual response body\n being available in the `content` attribute. Some endpoints return a stream, which is then available in `stream`.\n For some cases, like following the logs or events stream, you need to provide a callback which is called for every\n response line, see example 3 below.\n\n### Example 1: `docker info`\n\nA basic example connecting to a Docker daemon running in a VM (boot2docker/machine) looks like this:\n\n    System.setProperty(\"docker.cert.path\", \"/Users/${System.getProperty('user.name')}/.docker/machine/machines/default\")\n    def dockerClient = new DockerClientImpl(System.getenv(\"DOCKER_HOST\"))\n    def info = dockerClient.info().content\n\n### Example 2: `docker run`\n\nRunning a container being available on the host via HTTP port 4712 can be achieved like this:\n\n    System.setProperty(\"docker.cert.path\", \"/Users/${System.getProperty('user.name')}/.docker/machine/machines/default\")\n    def dockerClient = new DockerClientImpl(System.getenv(\"DOCKER_HOST\"))\n    def image = \"busybox\"\n    def tag = \"latest\"\n    def cmds = [\"sh\", \"-c\", \"ping 127.0.0.1\"]\n    def containerConfig = [\"Cmd\"         : cmds,\n                           \"ExposedPorts\": [\"4711/tcp\": [:]],\n                           \"HostConfig\"  : [\"PortBindings\": [\n                                   \"4711/tcp\": [\n                                           [\"HostIp\"  : \"0.0.0.0\",\n                                            \"HostPort\": \"4712\"]]\n                           ]]]\n    def result = dockerClient.run(image, containerConfig, tag).content\n\n### Example 3: `docker logs --follow`\n\n    def callback = new DockerAsyncCallback() {\n        def lines = []\n\n        @Override\n        def onEvent(Object line) {\n            println line\n            lines \u003c\u003c line\n        }\n    }\n\n    dockerClient.logs(\"foo\", [tail: 1], callback)\n\n    // callback.lines will now collect all log lines\n    // you might implement it as a fifo instead of the List shown above\n\n### Example 4: `docker stack deploy --compose-file docker-stack.yml example`\n\n    def dockerClient = new DockerClientImpl()\n    dockerClient.initSwarm()\n\n    def namespace = \"example\"\n    def composeStack = getClass().getResourceAsStream('docker-stack.yml')\n    String workingDir = Paths.get(getClass().getResource('docker-stack.yml').toURI()).parent\n\n    def deployConfig = new DeployConfigReader(dockerClient).loadCompose(namespace, composeStack, workingDir)\n\n    def options = new DeployStackOptions()\n    dockerClient.stackDeploy(namespace, deployConfig, options)\n\n\n## Usage with Gradle Docker Plugin\n\nMy personal focus implementing this Docker client was to leverage the Docker engine API in our Gradle scripts.\nA convenient integration in Gradle is possible by using the [Gradle Docker Plugin](https://github.com/gesellix/gradle-docker-plugin),\nwhich will be developed along with the Docker client library.\n\n## Contributing and Future Plans\n\nIf something doesn't work as expected or if you have suggestions, please [create an issue](https://github.com/gesellix/docker-client/issues).\nPull requests are welcome as well!\n\nThe developer api is quite rough, but that's where you can certainly help: I'll add a more convenient layer\n on top of the raw interface so that for 80% of common use cases the Docker client\n should help _**you**_ to get it working without digging too deep into the source code.\n So, all I need is an indication about how you'd like that convenience layer to look like.\n Feel free to create an issue where we can discuss how your use case could be implemented!\n\n\u003ca href='https://ko-fi.com/A0443PQL' target='_blank'\u003e\u003cimg height='36' style='border:0px;height:36px;' src='https://az743702.vo.msecnd.net/cdn/kofi4.png?v=0' border='0' alt='Buy Me a Coffee at ko-fi.com' /\u003e\u003c/a\u003e\n\n## Publishing/Release Workflow\n\nSee RELEASE.md\n\n## License\n\nMIT License\n\nCopyright 2015-2021 [Tobias Gesellchen](https://www.gesellix.net/) ([@gesellix](https://twitter.com/gesellix))\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","funding_links":["https://github.com/sponsors/gesellix","https://patreon.com/gesellix","https://ko-fi.com/A0443PQL'"],"categories":["Development with Docker","Dev Tools"],"sub_categories":["API Client"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgesellix%2Fdocker-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgesellix%2Fdocker-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgesellix%2Fdocker-client/lists"}