ssh argument not working as expected
See original GitHub issueI have been working on porting a bash script which I use to build some of my docker images to python, and your package has been a great help! I appreciate how easy and straightforward it is to port my docker run commands directly to python.
I just ran into an issue with the ssh
arg though. Looks like when setting ssh=default
in the docker.build()
command, I see an error:
error: invalid empty ssh agent socket, make sure SSH_AUTH_SOCK is set
I checked, and that variable is set in my shell environment. Any suggestions? Am I using the argument incorrectly? The same bash script with --ssh default
is working without problems.
Let me know if I can provide anything to help debug. Thanks!
raise DockerException(
python_on_whales.utils.DockerException: The docker command executed was `/usr/bin/docker buildx build --build-arg FROM_TAG=gui-support --ssh default --file docker/ros/kinetic/autoyard-core/Dockerfile --tag ros-kinetic-autoyard-core:test --iidfile /tmp/tmpc9q55l8w/id_file.txt .`.
It returned with code 1
Logged the variable with print("SSH socket {}".format(os.environ['SSH_AUTH_SOCK']))
and can see that the variable is printed correctly, but the docker build command still fails:
SSH socket /run/user/1001/keyring/ssh
error: invalid empty ssh agent socket, make sure SSH_AUTH_SOCK is set
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
Thank you for this great bug report! Reading the code with this in mind, I understand what is wrong. Is right way to fix it is to have a dict and put os.environ inside, then put the custom environment variables inside. Something like
I noticed this bug before in the bake command and fixed it, but my fix wasn’t very good because it worked only for bake. I’ll make a fix today or tomorrow. Thanks again for making this package better!
I’m happy that this package helps you!