For that, you need docker registry on your local machine or on Jenkins server where Jenkins is running.
Just run the docker registry container
docker run -d -p 5000:5000 --restart always --name registry registry:2
First tag your image
docker tag alpine localhost:5000/gcc/sample:latest
push that image to your local docker registry
docker push localhost:5000/gcc/sample:latest
Now if you want to pull that docker images in jenkins so give pull path with dns as we pull some thing from docker registry its contain full name with dns.
docker pull localhost:5000/gcc/sample:latest
A registry is a storage and content delivery system, holding named Docker images, available in different tagged versions.
docker pull ubuntu instructs docker to pull an image named ubuntu from the official Docker Hub. This is simply a shortcut for the longer docker pull docker.io/library/ubuntu command
docker pull myregistrydomain:port/foo/bar instructs docker to contact
the registry located at myregistrydomain:port to find the image
foo/bar
Running your own Registry is a great solution to integrate with and
complement your CI/CD system.
https://docs.docker.com/registry/introduction/
gcc/sample:latest
found locally? Does it appear when you rundocker image ls
with tag latest? – Harlin