If ENVBUILDER_GIT_URL does not start with http:// or https://, envbuilder assumes SSH authentication. You can authenticate using one of the following three methods:
1. Private Key File
Set ENVBUILDER_GIT_SSH_PRIVATE_KEY_PATH to the path of an SSH private key mounted inside the container.
docker run -it --rm \
-v /tmp/envbuilder:/workspaces \
-e ENVBUILDER_GIT_URL=git@example.com:path/to/private/repo.git \
-e ENVBUILDER_INIT_SCRIPT=bash \
-e ENVBUILDER_GIT_SSH_PRIVATE_KEY_PATH=/.ssh/id_rsa \
-v /home/user/id_rsa:/.ssh/id_rsa \
ghcr.io/coder/envbuilder
2. Base64 Encoded Private Key
Set ENVBUILDER_GIT_SSH_PRIVATE_KEY_BASE64 to the base64-encoded content of your private key.
docker run -it --rm \
-v /tmp/envbuilder:/workspaces \
-e ENVBUILDER_GIT_URL=git@example.com:path/to/private/repo.git \
-e ENVBUILDER_INIT_SCRIPT=bash \
-e ENVBUILDER_GIT_SSH_PRIVATE_KEY_BASE64=$(base64 < ~/.ssh/id_ed25519) \
ghcr.io/coder/envbuilder
3. SSH Agent
Mount your SSH agent socket and set the SSH_AUTH_SOCK environment variable.
docker run -it --rm \
-v /tmp/envbuilder:/workspaces \
-e ENVBUILDER_GIT_URL=git@example.com:path/to/private/repo.git \
-e ENVBUILDER_INIT_SCRIPT=bash \
-e SSH_AUTH_SOCK=/tmp/ssh-auth-sock \
-v $SSH_AUTH_SOCK:/tmp/ssh-auth-sock \
ghcr.io/coder/envbuilder
Note on Host Keys: By default, envbuilder accepts and logs all host keys. For strict host key checking, set SSH_KNOWN_HOSTS and mount a known_hosts file.