Manage multiple Docker Hub accounts from the command line.
Docker only reads credentials from the active DOCKER_CONFIG, which makes switching between personal, work, and automation accounts awkward. You either keep logging in and out, manually juggle config directories, or risk pushing and pulling with the wrong account.
docker-use keeps each account in its own isolated Docker config and lets your shell switch between them by name.
brew tap chiragagg5k/tools
brew install docker-useOr download a binary from the releases page.
Add the following to your shell rc file (e.g., ~/.zshrc):
eval "$(docker-use init zsh)"The generated wrapper calls docker-use <name> and assigns the returned path to DOCKER_CONFIG without shell eval during account switching.
Supported shells: zsh, bash, fish.
docker-use list # list accounts
docker-use whoami # show current account
docker-use add <name> -u <user> # add a new account (interactive docker login)
docker-use add <name> -u <user> --force # replace an existing account
docker-use remove <name> # remove an account (with confirmation)
docker-use <name> # switch to an account (requires shell wrapper)Each account lives in ~/.docker-accounts/<name>/config.json. Account names must match ^[a-zA-Z0-9][a-zA-Z0-9._-]{0,63}$. When you use an account, the shell wrapper sets DOCKER_CONFIG to that directory, so docker commands use the right credentials.
During add, docker-use shells out to docker login, then preserves Docker's generated credential helper settings such as credsStore: osxkeychain so Docker Desktop and platform keychains keep working inside the selected account config.
