Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ssh -o ControlMaster=auto causing issue with docker-credential-gcr authentication? #78

Open
ca-scribner opened this issue Mar 21, 2020 · 0 comments

Comments

@ca-scribner
Copy link

(cross posted with superuser - sorry, not sure the best place to ask)

Via a python script, I am on a GCP VM trying to install docker, download docker-credential-gcr, and then authenticate+pull an image from gcr.

The commands are:

  1. sudo apt-get update && sudo apt-get install -y docker.io && sudo usermod -aG docker $USER
  2. (download docker-credential-gcr to ~/credential_getter/docker-credential-gcr)
  3. PATH=$PATH:~/credential_getter && docker-credential-gcr configure-docker && docker pull mycontainer_in_gcr

To submit each above command, I use the following:

ssh -i my.pem -o ConnectTimeout=120s -o StrictHostKeyChecking=no -o ControlMaster=auto -o ControlPath=/tmp/mypath/%C -o ControlPersist=10s -o IdentitiesOnly=yes -o ExitOnForwardFailure=yes -o ServerAliveInterval=5 -o ServerAliveCountMax=3 UNAME@IPADDRESS bash --login -c -i 

Where I use ControlMaster to reduce any lag between commands.

Commands 1) and 2) work fine, but with 3) I get strange behavior where the docker-credential-gcr prints to the screen as per normal saying it worked correctly, but then docker pull fails with a credential error. But then if I go into my terminal a few moments after 3) fails and paste the same ssh command as from 3), the command works correctly. Similarly, if I put a wait in the python script between 2) and 3) of more than the ControlMaster timeout, it works correctly.

If I send all three commands in the python script using:

ssh -i my.pem -o ConnectTimeout=120s -o StrictHostKeyChecking=no -o IdentitiesOnly=yes -o ExitOnForwardFailure=yes -o ServerAliveInterval=5 -o ServerAliveCountMax=3 UNAME@IPADDRESS bash --login -c -i COMMAND

(ControlMaster settings removed) it also works fine.

Any idea what could cause these different behaviors?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant