Skip to content

Instantly share code, notes, and snippets.

@rcmorano
Created March 29, 2017 09:52
Show Gist options
  • Save rcmorano/e51935a2c1427c98c91757f33a71ab0b to your computer and use it in GitHub Desktop.
Save rcmorano/e51935a2c1427c98c91757f33a71ab0b to your computer and use it in GitHub Desktop.
expect script to interact with "docker login"
#!/bin/bash
#DOCKER_REGISTRY_URI=_DOCKER_REGISTRY_URI_
#DOCKER_REGISTRY_USER=_DOCKER_REGISTRY_USER_
#DOCKER_REGISTRY_PASS=_DOCKER_REGISTRY_PASS_
expect <<EOF
spawn docker login -u $DOCKER_REGISTRY_USER $DOCKER_REGISTRY_URI
while (1) {
expect {
-re ".*Password:.*" { send "$DOCKER_REGISTRY_PASS\r" }
eof { break }
}
}
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment