Use an SSH agent for authentication

If you want to use ssh-agent for passing your SSH key, you must run the installer container in the --privileged mode to allow using the ssh-agent sockets inside the container. This procedure is optional.

Procedure

  1. Ensure you have ssh-agent working and you have unlocked your SSH private key. Then, run the following command:
    $ ssh-add
    Enter passphrase for /home/<username>/.ssh/id_rsa:
    Identity added: /home/<username>/.ssh/id_rsa (/home/<username>/.ssh/id_rsa)
  2. In your installer invocation, replace:
    -v ~/.ssh/id_rsa:/ssh-keyfile:Z

    with the following:

    --privileged -v $SSH_AUTH_SOCK:$SSH_AUTH_SOCK:Z -e SSH_AUTH_SOCK=$SSH_AUTH_SOCK
    • --privileged This is so the container has access to the ssh-agent sockets.
    • -v $SSH_AUTH_SOCK:$SSH_AUTH_SOCK:Z This is to pass the SSH authentication socket to the container filesystem, so that the container can access your SSH key.
    • -e SSH_AUTH_SOCK=$SSH_AUTH_SOCK This is to set the environment variable in the container runtime pointing to the location of the SSH authentication socket.