Home > Back-end >  Docker pull from local repository Fails
Docker pull from local repository Fails

Time:05-14

Probably a very basic question but I can't seem to get my head around this.

So, I have a docker file, which I have built and it builds successfully and I can also run it and do stuffs, on my local PC, so, that's great.

However, I can't seem to pull the same image (the one that I created from my Dockerfile), if I just do docker pull for the same image. As I understand, if Docker finds the image locally, it should be able to pull it

So, here it is (a little snippet of my Dockerfile)

FROM companyartifactoryurl/ubuntu:someversion
ENV HTTP_PROXY=proxy:port
ENV HTTPS_PROXY=proxy:port
WORKDIR /code
.....other stuffs....
COPY ./requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
COPY ./model /code/model
CMD something

I build it and get the image and it is tagged

testaks

When I do

docker images

I can see

REPOSITORY |  TAG     | IMAGE ID | CREATED | SIZE
testaks      latest      SomeID     ADate     A Size

However, when I do

docker pull testaks

I get an error

Error response from daemon: Get "https://registry-1.docker.io/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

So, it is able to go fetch ubuntu (from by dockerfile definition) but can't fetch an image from my local repo? I tried giving it other tags , apart from the default of latest, but it doesn't work.

What am I missing?

I am just trying to do some POCs and learn, so not yet ready to push to an artifactory (my image), but just try out the local one. Also, the proxy is an org one.

CodePudding user response:

U got error because u trying to get testaks from default docker.io registry. U can create Docker Registry localy, here is docker docs how to do it.

docker run -d -p 5000:5000 --name registry registry:2

then u can tag your image and push to local registry

docker image tag testaks localhost:5000/testaks
docker push localhost:5000/testaks

Now u can try pull

docker pull localhost:5000/testaks
  • Related