Docker API GraphQL
A GraphQL API Server around the Docker Remote API. SpringBoot-based app, written in Kotlin.
Table of Contents generated with DocToc
- Running with Docker
- API Endpoints
- Building from source
- Contributing and Improving docker-api-graphql!
- Open-Source Libraries and Tools
- Developed by
Running with Docker
This app can run as a lightweight Docker container.
To use it against a local Docker daemon listening on a local Unix socket:
docker run \ --name docker-api-graphql \ -d \ -p 8080:8080 \ -v /var/run/docker.sock:/var/run/docker.sock \ rm3l/docker-api-graphql
-v /var/run/docker.sock:/var/run/docker.sock option can be used in Linux environments only.
For more sophisticated use cases of Docker daemons accessible over the network (and secured with client certificates):
docker run \ --name docker-api-graphql \ -d \ -p 8080:8080 \ -e DOCKER_HOST=https://<host>:<port> \ -v /path/to/my/docker/folder/containing/my/certificates:/etc/docker \ rm3l/docker-api-graphql
/path/to/my/docker/folder/containing/my/certificates must be mounted under
/etc/docker inside the running container, and must follow the semantics behind the DOCKER_CERT_PATH environment variable
You'll just need to access the port 8080 of the Docker engine where
docker-api-graphql is running using your browser.
Deploying this API to manage a Swarm cluster is just as easy ! You can directly deploy it as a service in your Docker cluster:
docker service create \ --name docker-api-graphql \ -d \ --publish 8080:8080 \ --constraint 'node.role == manager' \ --mount type=bind,src=//var/run/docker.sock,dst=/var/run/docker.sock \ rm3l/docker-api-graphql \ -H unix:///var/run/docker.sock
This gives you access to a GraphiQL application in your browser, so you can play with the GraphQL API
This is the entrypoint for the GraphQL API.
Building from source
You can build
docker-api-graphql in the same way as any Gradle project on Git.
However, thanks to the Gradle Wrapper (cf.
you do not need to have Gradle installed on your machine.
- Clone the
docker-api-graphqlrepository on your machine:
git clone https://github.com/rm3l/docker-api-graphql && cd docker-api-graphql
- Switch to the appropriate branch if needed with
git checkout ...
- Execute a Gradle build in the directory containing the
- You will find the WAR artifact under the
Contributing and Improving docker-api-graphql!
Contributions and issue reporting are more than welcome. So to help out, do feel free to fork this repo and open up a pull request. I'll review and merge your changes as quickly as possible.
You can use GitHub issues to report bugs. However, please make sure your description is clear enough and has sufficient instructions to be able to reproduce the issue.
- Map other endpoints of the Docker Remote API, e.g,: Services, Secrets, Tasks, ...
- GraphQL Mutations
- GraphQL Subscriptions if possible, especially for Docker events
- Authentication / Authorization
Open-Source Libraries and Tools
- Armel Soro
The MIT License (MIT) Copyright (c) 2017 Armel Soro Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.