on ubuntu:
docker login
so if you don't know your username password, you probably haven't created one. what you should do, is go and create an id on docker visit: official docker webpage
just like any other github accout ,they will ask you for the username, provide one and they will authenticate same as github, once done , put your email and password. verify it and you are now good to go.
ok! now coming to the point... if you were facing the problem like the problem statement , just do
docker login
enter username and password, that you just provided . you will be displayed ,"LOGIN succeeded"
now run this command
docker run hello-world
beware of the dash '-' sign , i myself stuck with this issue, and you are done.
thanks:)