What changing your Docker username means

Docker usernames are not the same as your system username or SSH login. Your Docker username is the account you use to log into Docker Hub, the registry where Docker stores and shares container images. Changing it means updating the credentials Docker uses when you push images to Docker Hub, pull private images, or manage repositories online.

You cannot rename a Docker Hub account directly through Docker itself. Instead, you change the username by creating a new Docker Hub account with the name you want, then updating your local Docker configuration to use those new credentials. Your old account remains unchanged — this process straightforward switches which account your computer logs into.

Key Takeaways

  • Docker usernames are separate from your system login and are used only for Docker Hub, the online image registry.
  • You cannot rename an existing Docker Hub account; you must create a new account with the desired username.
  • After creating a new Docker Hub account, run docker logout followed by docker login to switch your local credentials.
  • Your old Docker Hub account and any repositories under it will remain unchanged unless you manually delete them.
  • If you want to keep your existing repositories, you can transfer ownership of them to the new account through Docker Hub's web interface.

Create a new Docker Hub account with your desired username

Go to hub.docker.com and click the Sign Up button in the top right. Enter an email address, choose your new username, create a password, and complete the verification steps Docker sends to your email. Docker Hub usernames must be lowercase, start with a letter or number, and can contain hyphens and underscores.

Write down your new username and password somewhere find. You will need both when you log in from your computer. If you already have repositories under your old account that you want to keep using, note their current names — you will need to transfer them after you switch usernames.

Log out of Docker on your computer

Open a terminal or command prompt and run:

docker logout

This removes your current Docker credentials from your local machine. Docker stores login information in a configuration file, and docker logout clears it. You will not be able to push images or pull private repositories until you log back in with new credentials.

Log in with your new Docker Hub credentials

Run the following command:

docker login

Docker will prompt you for your username and password. Enter the new username you created on Docker Hub and the password you set during account creation. Docker will authenticate with Docker Hub and store your new credentials locally.

If the login succeeds, you will see a message saying "Login Succeeded". Your computer is now configured to use your new Docker Hub account. Any images you push will be stored under your new username.

Transfer repositories if you want to keep them

If you have existing repositories under your old Docker Hub account that you want to continue using, you can transfer ownership to your new account. Log into Docker Hub with your old account, go to each repository's settings, and look for a "Transfer Repository" or similar option. Select your new account as the destination.

After transfer, the repository will appear under your new username. You can then pull and push to it using your new credentials. If you do not transfer repositories, they remain under your old account and you cannot modify them with your new login.

Verify your new login is working

Push a test image to confirm Docker is using your new credentials. Build a straightforward image or use an existing one, then run:

docker push yourusername/test-image:latest

Replace yourusername with your actual new Docker Hub username. If the push succeeds, your new login is working correctly. If Docker returns an authentication error, run docker login again and double-check that you entered your username and password correctly.

What to do if you need to switch back

If you want to use your old Docker Hub account again, run docker logout followed by docker login, then enter your old credentials. Docker will switch back to your previous account. You can switch between accounts as often as you need by logging out and logging back in with different credentials.

Keep in mind that only one set of credentials can be active on your computer at a time. If you work with repositories under both accounts, you will need to log out and log back in each time you switch between them.

Frequently Asked Questions

Can I rename my existing Docker Hub account instead of creating a new one?

Docker Hub does not offer a rename feature for existing accounts. You must create a new account with your desired username. If you have repositories you want to keep, transfer them to the new account through Docker Hub's web interface before deleting the old one.

What happens to my old Docker Hub account after I change my Docker username?

Your old account remains active on Docker Hub unless you manually delete it. Any repositories and images stored under it will stay there. You can log back into the old account at any time by running docker login with those credentials.

Will changing my Docker username affect my system login or SSH access?

No. Docker usernames are only for Docker Hub and do not affect your system username, SSH credentials, or any other login. Changing your Docker username has no impact on how you access your server or computer.

Do I need to update my Dockerfile or docker-compose.yml after changing my username?

Only if those files reference your old Docker Hub username in image names. For example, if a Dockerfile contains FROM oldusername/myimage:latest, you should update it to FROM newusername/myimage:latest if you transferred the repository to your new account.

Can I use the same email address for both my old and new Docker Hub accounts?

No. Docker Hub requires a unique email address for each account. You will need to use a different email when creating your new account, or remove the email from your old account first.