Skip to content

Variable: buildDockerSSHConnectionOptions ​

const buildDockerSSHConnectionOptions: ComponentOptionsBuilder<IDockerSSHConnectionOptions>

Build the component options of a Docker connected to a remote daemon over SSH, as DOCKER_HOST=ssh://user@host does, to register it in the components of an application. The requests go through docker system dial-stdio run on the remote host, which needs the Docker CLI; locally, the optional package ssh2 must be installed. The SSH connection authenticates through the SSH agent (no password). The options are validated when the component is created, not here.

Param ​

options

The host and port (the SSH port, usually 22) of the remote host, the username, the SSH agent's socket (sshAuthAgent; SSH_AUTH_SOCK by default), the timeout and the API version; the protocol is set to 'ssh'.

Returns ​

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

Example ​

typescript
import {Application} from 'lakutata'
import {buildDockerSSHConnectionOptions} from 'lakutata/com/docker'

Application.run(() => ({
    id: 'docker.app',
    name: 'Docker',
    components: {
        docker: buildDockerSSHConnectionOptions({host: 'docker.example.com', port: 22, username: 'deploy'})
    }
}))

Released under the MIT License.