泊坞窗撰写简化版,允许使用本地图片

问题描述:

下面的命令失败,试图从泊坞枢纽拉图像:泊坞窗撰写简化版,允许使用本地图片

$ docker-compose up -d 
Pulling web-server (web-server:staging)... 
ERROR: repository web-server not found: does not exist or no pull access 

但我只是想使用的图像,它存在的本地版本:

$ docker images 
REPOSITORY   TAG     IMAGE ID   CREATED    SIZE 
web-server   staging    b94573990687  7 hours ago   365MB 

为什么Docker不在本地存储的图像中搜索?


这是我的码头工人撰写文件:

version: '3' 
services: 
    chat-server: 
    image: chat-server:staging 
    ports: 
     - "8110:8110" 
    web-server: 
    image: web-server:staging 
    ports: 
     - "80:80" 
     - "443:443" 
     - "8009:8009" 
     - "8443:8443" 

和我.ENV文件:

DOCKER_HOST=tcp://***.***.**.**:2376 
DOCKER_TLS_VERIFY=true 
DOCKER_CERT_PATH=/Users/Victor/Documents/Development/projects/.../target/docker 
+3

您能否验证'web-server'镜像是在本地构建的吗?请包括'docker-compose.yml'文件 –

+0

也许这些工作之一:重新启动docker服务;用Docker构建再次构建Web服务器映像;然后,尝试码头合成运行。 –

+0

@DenisTsoi我已经添加了我的docker-compose文件。我该如何验证,该图像是在本地构建的?我提供了'docker images'命令的输出,它列出了我的图像。我想,它验证,图像实际上是在这里构建的。 –

在您的码头工人,compose.yml,您可以指定build: .而不是build: <username>/repo>为本地建设(而不是从码头枢纽拉) - 我无法验证这一点,但我相信你可能能够做相对轻拍hs为docker-compose文件提供多项服务。

services: 
    app: 
    build: . 

参考:https://github.com/gvilarino/docker-workshop

+2

我知道可以在本地构建图像,但我认为这不是一个好主意。在我看来,最好分离这里提到的构建和运行步骤:https://12factor.net/build-release-run –

+0

这是一个好点,我同意 - 这不应该在任何正常情况下使用,但是,我相信这是一个快速的步骤,而不是在本地建设,然后推到码头集线器(特别是如果你想检查服务是否相互通信) –

一般情况下,当你形容这应该工作。试图模仿它,但它只是工作...

文件夹结构:Dockerfile的

. 
├── docker-compose.yml 
└── Dockerfile 

内容:

FROM alpine 
CMD ["echo", "i am groot"] 

构建和标签图像:

docker build -t groot . 
docker tag groot:latest groot:staging 

与docker-compose.yml:

version: '3.1' 
services: 
    groot: 
    image: groot:staging 

,并开始坞窗 - 撰写:

$ docker-compose up 
Creating groot_groot ... 
Creating groot_groot_1 ... done 
Attaching to groot_groot_1 
groot_1 | i am groot 
groot_groot_1 exited with code 0 

您可能需要改变你的形象标签有两个部分用斜线分开/。因此,而不是

chat-server:staging 

做这样的事情:

victor-dombrovsky/chat-server:staging 

我觉得有泊坞窗标签和“一个部分”标签背后的一些逻辑的解释为DockerHub来的官方图片。