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

because I only have one linux service, I want to test it and build a private docker repository.
if so, how can I push the image to the local private repository?

Mar.19,2021

can be 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
Menu