在gitlab ci

时间:2018-09-22 14:54:30

标签: docker gitlab gitlab-ci

我有以下gitlab ci职位:

image: docker:stable

services:
  - docker:dind

stages:
  - debug

Debug registry login:
  stage: debug
  script:
    - docker login --username "$CI_REGISTRY_USER" --password "$CI_REGISTRY_PASSWORD" registry.exemple.com:port/

但是作业失败,并出现以下错误:

Error response from daemon: 
Get https://registry.exemple.com:port/v2/: net/http: 
request canceled while waiting for connection 
(Client.Timeout exceeded while awaiting headers)

正确设置了“ $ CI_REGISTRY_USER”和“ $ CI_REGISTRY_PASSWORD”,我试图回显它们,并显示了正确的值。

容器注册表,gitlab实例和运行程序都在同一台ubuntu服务器上。

如果我尝试通过个人计算机中的命令或通过运行该任务的服务器登录该任务,则连接成功。

跑步者的配置:

[[runners]]
  name = "Smooth"
  url = "https://git.exemple.fr"
  token = "a5e28f2c95cf5ff887edb535f80e37"
  executor = "docker"
  [runners.docker]
    tls_verify = false
    image = "docker:stable"
    privileged = true
    disable_cache = false
    volumes = ["/cache"]
    shm_size = 0
  [runners.cache]

1 个答案:

答案 0 :(得分:1)

起初,我认为此问题与cloudflare DNS的使用有关,但实际上是因为我在ubuntu服务器上启用了ufw(不复杂的防火墙),该服务器在子域下为gitlab实例和gitlab容器注册表提供服务。解决方案很简单:

import numpy as np
import pickle
import h5py

# read nparray, dimensions (102000, 60)

infile = open(r'file.dat', 'rb')
x = pickle.load(infile)
infile.close()     

# z-normalize the data -- first compute means and standard deviations
xave = np.average(x,axis=1)
xstd = np.std(x,axis=1)

# transpose for the sake of broadcasting (doesn't seem to work otherwise!)
ztrans = x.T - xave
ztrans /= xstd

# transpose back
z = ztrans.T

# compute correlation matrix - shape = (102000, 102000)
arr = np.matmul(z, z.T)   
arr /= z.shape[0]

# output to HDF5 file
with h5py.File('correlation_matrix.h5', 'w') as hf:
        hf.create_dataset("correlation",  data=arr)

sudo ufw allow [port] 是gitlab容器注册表使用的端口

尽管我不理解为什么我可以从笔记本电脑或服务器上[port]来解决ufw问题,但不能从CI作业中解决问题