Can the docker private warehouse and the docker image to be pushed be located on the same machine?

  docker, question

Because I only have one linux service, I want to test it and build a private docker warehouse.
If so, how can I push the mirror to the local private warehouse?

Can be located on the same machine:

docker run -d -p 5000:5000 --name registry registry:2
 docker image tag nginx:latest  localhost:5000/nginx:latest
 docker push localhost:5000/nginx:latest