echo 's3cr3t' | docker login registry.example.com -u myuser --password-stdin

Category: Docker

echo 's3cr3t' | docker login registry.example.com -u myuser --password-stdin

Log in reading the password from stdin

Feeds the password through stdin so it never appears in shell history or process listings. The pattern suits CI and scripts. Credentials are stored in ~/.docker/config.json, so log out when done on shared machines.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.