DockerEngineAPI.Api.Service (elixir_dea v1.45.7)

API calls for all endpoints tagged Service.

Summary

Functions

Get service logs Get stdout and stderr logs from a service. See also /containers/{id}/logs. Note: This endpoint works only for services with the local, json-file or journald logging drivers.

Functions

Link to this function

service_create(connection, body, opts \\ [])

Create a service

Parameters

  • connection (DockerEngineAPI.Connection): Connection to server
  • body (ServiceCreateRequest):
  • opts (keyword): Optional parameters
    • :"X-Registry-Auth" (String.t): A base64url-encoded auth configuration for pulling from private registries. Refer to the authentication section for details.

Returns

  • {:ok, DockerEngineAPI.Model.ServiceCreateResponse.t} on success
  • {:error, Tesla.Env.t} on failure
Link to this function

service_delete(connection, id, opts \\ [])

@spec service_delete(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, nil}
  | {:ok, DockerEngineAPI.Model.ErrorResponse.t()}
  | {:error, Tesla.Env.t()}

Delete a service

Parameters

  • connection (DockerEngineAPI.Connection): Connection to server
  • id (String.t): ID or name of service.
  • opts (keyword): Optional parameters

Returns

  • {:ok, nil} on success
  • {:error, Tesla.Env.t} on failure
Link to this function

service_inspect(connection, id, opts \\ [])

@spec service_inspect(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, DockerEngineAPI.Model.Service.t()}
  | {:ok, DockerEngineAPI.Model.ErrorResponse.t()}
  | {:error, Tesla.Env.t()}

Inspect a service

Parameters

  • connection (DockerEngineAPI.Connection): Connection to server
  • id (String.t): ID or name of service.
  • opts (keyword): Optional parameters
    • :insertDefaults (boolean()): Fill empty fields with default values.

Returns

  • {:ok, DockerEngineAPI.Model.Service.t} on success
  • {:error, Tesla.Env.t} on failure
Link to this function

service_list(connection, opts \\ [])

@spec service_list(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, [DockerEngineAPI.Model.Service.t()]}
  | {:ok, DockerEngineAPI.Model.ErrorResponse.t()}
  | {:error, Tesla.Env.t()}

List services

Parameters

  • connection (DockerEngineAPI.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :filters (String.t): A JSON encoded value of the filters (a map[string][]string) to process on the services list. Available filters: - id=<service id> - label=<service label> - mode=["replicated"|"global"] - name=<service name>
    • :status (boolean()): Include service status, with count of running and desired tasks.

Returns

  • {:ok, [%Service{}, ...]} on success
  • {:error, Tesla.Env.t} on failure
Link to this function

service_logs(connection, id, opts \\ [])

@spec service_logs(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, DockerEngineAPI.Model.ErrorResponse.t()}
  | {:ok, String.t()}
  | {:error, Tesla.Env.t()}

Get service logs Get stdout and stderr logs from a service. See also /containers/{id}/logs. Note: This endpoint works only for services with the local, json-file or journald logging drivers.

Parameters

  • connection (DockerEngineAPI.Connection): Connection to server
  • id (String.t): ID or name of the service
  • opts (keyword): Optional parameters
    • :details (boolean()): Show service context and extra details provided to logs.
    • :follow (boolean()): Keep connection after returning logs.
    • :stdout (boolean()): Return logs from stdout
    • :stderr (boolean()): Return logs from stderr
    • :since (integer()): Only return logs since this time, as a UNIX timestamp
    • :timestamps (boolean()): Add timestamps to every log line
    • :tail (String.t): Only return this number of log lines from the end of the logs. Specify as an integer or all to output all log lines.

Returns

  • {:ok, String.t} on success
  • {:error, Tesla.Env.t} on failure
Link to this function

service_update(connection, id, version, body, opts \\ [])

Update a service

Parameters

  • connection (DockerEngineAPI.Connection): Connection to server
  • id (String.t): ID or name of service.
  • version (integer()): The version number of the service object being updated. This is required to avoid conflicting writes. This version number should be the value as currently set on the service before the update. You can find the current version by calling GET /services/{id}
  • body (ServiceUpdateRequest):
  • opts (keyword): Optional parameters
    • :registryAuthFrom (String.t): If the X-Registry-Auth header is not specified, this parameter indicates where to find registry authorization credentials.
    • :rollback (String.t): Set to this parameter to previous to cause a server-side rollback to the previous service spec. The supplied spec will be ignored in this case.
    • :"X-Registry-Auth" (String.t): A base64url-encoded auth configuration for pulling from private registries. Refer to the authentication section for details.

Returns

  • {:ok, DockerEngineAPI.Model.ServiceUpdateResponse.t} on success
  • {:error, Tesla.Env.t} on failure