-
Notifications
You must be signed in to change notification settings - Fork 93
Description
(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:
- sudo apt-get update && sudo apt-get install -y docker.io && sudo usermod -aG docker $USER
- (download docker-credential-gcr to ~/credential_getter/docker-credential-gcr)
- 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?