可能是一個非常基本的問題,但我似乎無法理解這個問題。
所以,我有一個 docker 檔案,我已經構建并且它構建成功,我還可以在本地 PC 上運行它并做一些事情,所以,這很棒。
但是,如果我只是為同一個影像執行 docker pull,我似乎無法提取相同的影像(我從 Dockerfile 創建的影像)。據我了解,如果 Docker 在本地找到影像,它應該能夠拉取它
所以,這里是(我的 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
我構建它并獲取影像并標記它
testaks
當我做
docker images
我可以看到
REPOSITORY | TAG | IMAGE ID | CREATED | SIZE
testaks latest SomeID ADate A Size
但是,當我這樣做時
docker pull testaks
我收到一個錯誤
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)
那么,它能夠獲取 ubuntu(通過 dockerfile 定義)但不能從我的本地倉庫獲取影像?我嘗試給它其他標簽,除了默認的最新,但它不起作用。
我錯過了什么?
我只是在嘗試做一些 POC 和學習,所以還沒有準備好推向一個人工制品(我的形象),但只是嘗試一下本地的。此外,代理是一個組織。
uj5u.com熱心網友回復:
你得到了錯誤,因為你試圖從默認的 docker.io 注冊表中獲取testaks 。你可以在本地創建 Docker Registry,這里是 docker docs 怎么做。
docker run -d -p 5000:5000 --name registry registry:2
然后你可以標記你的影像并推送到本地注冊表
docker image tag testaks localhost:5000/testaks
docker push localhost:5000/testaks
現在你可以試試拉
docker pull localhost:5000/testaks
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/473636.html
下一篇:CDK:aws_cdk.aws_ecs.EcrImage與aws_cdk.aws_ecs.ContainerImage
