Gitlab-Runner显然会创建容器,但是此容器不在列表中

时间:2019-05-03 06:44:33

标签: docker continuous-integration gitlab gitlab-ci-runner

我已经在我的登台服务器上安装了gitlab-runner,在我的项目中,我有这个gitlab-ci.yml:

image: upmcedlp/gitlab-dind-node-java

services:
  - docker:dind

stages:
  - ver
  - init
  - tests
  - deploy

before_script:    
  - echo "---------- DOCKER LOGIN"      
  - docker login -u myusername -p "mypwd" registry.gitlab.com 

ver:
  stage: ver
  script:    
    - whoami

init:
  stage: init
  script:
- npm install

testing:
  stage: tests
  script:
    - npm test

deploy_staging:
  stage: deploy
  script:
    - echo "---------- START DEPLOYING STAGING SERVER"
    - echo "-> 1) build image"  
    - docker build -t registry.gitlab.com/admiralcrunch/portal_ci .
    - echo "-> 2) push image to registry"
    - docker push registry.gitlab.com/admiralcrunch/portal_ci          
    - echo "-> 3) kill old container"
    - docker kill $(docker ps -q) || true
    - docker rm $(docker ps -a -q) || true
    - echo "-> 4) start new container"
    - docker run -dt -p 3000:3000 --name portal registry.gitlab.com/admiralcrunch/portal_ci
    - echo "########## END DEPLOYING DOCKER IMAGE"
  environment:
    name: staging
    url: https://stage.latronic.com
  only:
    - master

deploy_production_1:
  stage: deploy
  script:
    - echo "Deployed to production server 1"
  environment:
  when: manual
  only:
    - master

deploy_production_2:
  stage: deploy
  script:
    - echo "Deployed to production server 2"
  environment:
  when: manual
  only:
    - master    

它正在运行,我可以看到-deploy_staging中的进程被杀死了,docker run -dt -p 3000:3000 --name portal admiralcrunch/portal_ci被执行而没有错误。我还可以看到gitlab-runner在登台服务器上创建的“工人”容器。

但是,当所有步骤完成后,绝对没有容器在运行(?)。这是为什么?我究竟做错了什么?我想念some吗?

0 个答案:

没有答案