/docker-engine-api-elixir

An autogenerated docker engine api library for Elixir, generated from the OpenAPI spec

Primary LanguageElixirMIT LicenseMIT

DockerEngineAPI

Hex.pm

The Engine API is an HTTP API served by Docker Engine. It is the API the Docker client uses to communicate with the Engine, so everything the Docker client can do can be done with the API. Most of the client's commands map directly to API endpoints (e.g. `docker ps` is `GET /containers/json`). The notable exception is running containers, which consists of several API calls.

Disclaimer: This package is autogenerated from dockers openapi spec, with a few adjustements for usability.

Building

To install the required dependencies and to build the elixir project, run:

mix local.hex --force
mix do deps.get, compile

Installation

If available in Hex, the package can be installed by adding ex_docker_engine_api to your list of dependencies in mix.exs:

def deps do
  [{:ex_docker_engine_api, "~> 1.43"}]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/ex_docker_engine_api.

Configuration

Multiple clients for the same API with different URLs can be created passing different base_urls when calling DockerEngineAPI.Connection.new/1:

client = DockerEngineAPI.Connection.new(base_url: "http://localhost/v1.43")

You can also adjust the Hackney adapters recv_timeout by passing it in as an option to the client constructor:

client = DockerEngineAPI.Connection.new(base_url: "http://localhost/v1.43", recv_timeout: 300_000)