millions-tailor-16868
06/03/2025, 9:04 AMdocker_environmentmillions-tailor-16868
06/03/2025, 9:04 AMmillions-tailor-16868
06/03/2025, 9:07 AMdocker_environment is working successfully, however when using a docker environment and the following settings, it is failing.
pants.toml
...
[subprocess-environment]
env_vars.add = [
"SSH_AUTH_SOCK"
]
[docker]
env_vars = [
"SSH_AUTH_SOCK"
]
[environments-preview.names]
pytest_env = "//docker/base_emr_serverless:tests-env-base-emr-7.8.0-python-3.11"
docker/base_emr_serverless/BUILD
docker_environment(
name="tests-env-base-emr-7.8.0-python-3.11",
image="<http://851725234266.dkr.ecr.us-east-2.amazonaws.com/thirdparty/base-emr-7.8.0-python-3.11:tests-0.1.0-temp-pearl-api|851725234266.dkr.ecr.us-east-2.amazonaws.com/thirdparty/base-emr-7.8.0-python-3.11:tests-0.1.0-temp-pearl-api>"
)
error during pants test
pip: note: This error originates from a subprocess, and is likely not a problem with pip.
pip: Running command git clone --filter=blob:none --quiet 'ssh://****@github.com/PearlHealth/pearl-api.git' /pants-named-caches/pex_root/pip/1/24.2/pip_cache/.tmp/pip-download-uhu5q7ca/pearl-api_74caf017c29e4da7a7141277ba4d88d9
pip: Host key verification failed.
pip: fatal: Could not read from remote repository.
pip: Please make sure you have the correct access rights
pip: and the repository exists.
pip: ERROR: git clone --filter=blob:none --quiet 'ssh://****@github.com/PearlHealth/pearl-api.git' /pants-named-caches/pex_root/pip/1/24.2/pip_cache/.tmp/pip-download-uhu5q7ca/pearl-api_74caf017c29e4da7a7141277ba4d88d9 exited with 128millions-tailor-16868
06/03/2025, 9:09 AMmillions-tailor-16868
06/03/2025, 9:10 AMbrief-engine-92399
10/20/2025, 2:25 PMbrief-engine-92399
10/20/2025, 2:38 PMbrief-engine-92399
10/20/2025, 2:38 PMbrief-scientist-13682
10/20/2025, 7:29 PM~/.ssh/known_hosts? If you're getting the exact error message in the OP, that appears to be the problem on that output; namely host key verification is enabled (is by default on most systems), but the session is not interactive and there is no known hosts file.brief-scientist-13682
10/20/2025, 7:29 PMbrief-engine-92399
10/20/2025, 7:30 PM[subprocess-environment]
env_vars.add = [
"SSH_AUTH_SOCK",
]
and
[docker]
env_vars = [
"SSH_AUTH_SOCK"
]brief-scientist-13682
10/20/2025, 7:34 PMSSH_AUTH_SOCK stuff; so you let the docker container see whatever path name is in the SSH_AUTH_SOCK environment variable.
You should dig a bit - is that path name mounted in the container? And, I don't know the answer to this question myself, is ssh-agent (the thing pointed at by SSH_AUTH_SOCK) responsible for both authentication of you to the server and host key checking? If so, then having SSH_AUTH_SOCK exposed and the path it exposes being real in the container should be enough, but if not, then you'd also need the known_hosts file available in the container too.
Just prodding you to dig a bit.brief-engine-92399
10/20/2025, 8:16 PMbrief-scientist-13682
10/20/2025, 8:30 PMSSH_AUTH_SOCK exposed to container
2. The path in SSH_AUTH_SOCK mounted into the container
3. The ~/.ssh/known_hosts file mounted into the container
Only with all 3 does password-less ssh auto-login work.
My rig:
cat << EOF | docker build -t example-ssh -
FROM alpine
RUN apk add openssh
EOF
The successful experiment:
:; docker run --rm -e SSH_AUTH_SOCK=/ssh-agent -v $SSH_AUTH_SOCK:/ssh-agent -v $HOME/.ssh/known_hosts:/root/.ssh/known_hosts example-ssh ssh jsirois@192.168.0.37 hostname
gill-mini.local
Remove the known_hosts mount and fail:
:; docker run --rm -e SSH_AUTH_SOCK=/ssh-agent -v $SSH_AUTH_SOCK:/ssh-agent example-ssh ssh jsirois@192.168.0.37 hostname
Host key verification failed.
Remove the `SSH_AUTH_SOCK`setup and fail differently:
:; docker run --rm -v $HOME/.ssh/known_hosts:/root/.ssh/known_hosts example-ssh ssh jsirois@192.168.0.37 hostname
Permission denied, please try again.
Permission denied, please try again.
Received disconnect from 192.168.0.37 port 22:2: Too many authentication failures
Disconnected from 192.168.0.37 port 22brief-scientist-13682
10/20/2025, 8:31 PMbrief-engine-92399
10/20/2025, 11:56 PMbrief-engine-92399
10/20/2025, 11:56 PMbrief-engine-92399
10/20/2025, 11:58 PMdocker_environmentbrief-scientist-13682
10/21/2025, 12:05 AM