簡體   English   中英

Gitlab-ci可以構建docker映像,但無法運行它

[英]Gitlab-ci can build docker image, but can't run it

我是gitlab-ci的新手。 可能我的git-labrunner或gitlab-ci.yml文件有問題。 我圖像上的腳本使用whois命令。

gitlab-ci.yml

image: docker:18

services:
 - docker:dind 

stages:
 - build
 - test

before_script:
 - docker info

build:
 stage: build
 script:
  - echo "build"
  - docker build -t image.

test:
 stage: test
 script:
  - echo "test"
  - docker run -i image 185.33.37.131

測試回報

$ docker run -i image 185.33.37.131
Unable to find image 'image:latest' locally
docker: Error response from daemon: pull access denied for image, repository does not exist or may require 'docker login'.
See 'docker run --help'.
ERROR: Job failed: exit code 125

碼頭工人信息返回可疑值

$ docker info
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 0
.
.
.
Successfully built 64f54ee594e7
Successfully tagged image:latest

您正在一個GitLab作業中構建映像,然后嘗試在另一個作業中運行它。 每個作業都是彼此隔離的,因此該映像將不再存在於測試作業中。 構建映像后,應將其推送到docker注冊表,然后在要運行它時將其從注冊表中拉出。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM