Skip to content

Variable: buildDockerHttpsConnectionOptions ​

说明

本页由源码中的注释生成,内容为英文。

const buildDockerHttpsConnectionOptions: ComponentOptionsBuilder<IDockerHttpsConnectionOptions>

Build the component options of a Docker connected to a daemon over HTTPS (dockerd --tlsverify -H tcp://0.0.0.0:2376), to register it in the components of an application. The options are validated when the component is created, not here.

Param ​

options

The host and port of the daemon, with the PEM contents of the authority (ca), the client certificate (cert) and its key (key), the headers, the timeout and the API version; the protocol is set to 'https'.

Returns ​

The component options ({class: Docker, protocol: 'https', ...options}).

Example ​

typescript
import {readFileSync} from 'node:fs'
import {Application} from 'lakutata'
import {buildDockerHttpsConnectionOptions} from 'lakutata/com/docker'

Application.run(() => ({
    id: 'docker.app',
    name: 'Docker',
    components: {
        //The PEM contents, not the file paths
        docker: buildDockerHttpsConnectionOptions({
            host: 'docker.example.com',
            port: 2376,
            ca: readFileSync('/etc/docker/certs/ca.pem'),
            cert: readFileSync('/etc/docker/certs/cert.pem'),
            key: readFileSync('/etc/docker/certs/key.pem')
        })
    }
}))

Released under the MIT License.