如何在GitLab运行器容器中安装软件包?

时间:2019-07-07 12:43:54

标签: linux docker gitlab command-line-interface

我正在尝试使用GitLab运行程序来实现某些cicd,
我是刚接触容器的人,正在尝试将zip软件包安装到容器中,
我可以使用pip安装awscli,但我无法安装shell脚本所需的zip软件包。

以下是.gitlab-ci.yml文件-

stages:
    - build

build:
    image: python:latest
    stage: build
    script:
        - pip install awscli
        - yum install zip
        - bash cicdScript.sh

我正在使用python容器,因为我的脚本需要awscli,
而且还需要zip包,
我尝试了以下-

1)

script:
            - pip install awscli
            - yum install zip
            - bash cicdScript.sh

给予-

/bin/bash: line 82: yum: command not found

2)

script:
            - pip install awscli
            - apt-get install zip unzip
            - bash cicdScript.sh

给予-

Reading package lists...
Building dependency tree...
Reading state information...
Package zip is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'zip' has no installation candidate

1 个答案:

答案 0 :(得分:0)

尝试更新,然后-y

apt-get update
apt-get install -y zip unzip