社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  Git

gitlab容器扫描程序无法安装aws cli

Evan R. • 4 年前 • 2153 次点击  

在gitlab CI文档中( https://docs.gitlab.com/ee/user/application_security/container_scanning/ ),说明可以使用以下方法扫描ECR:

container_scanning:
  before_script:
    - ruby -r open-uri -e "IO.copy_stream(URI.open('https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip'), 'awscliv2.zip')"
    - unzip awscliv2.zip
    - ./aws/install
    - aws --version
    - export AWS_ECR_PASSWORD=$(aws ecr get-login-password --region region)

include:
  - template: Security/Container-Scanning.gitlab-ci.yml
    DOCKER_IMAGE: <aws_account_id>.dkr.ecr.<region>.amazonaws.com/<image>:<tag>
    DOCKER_USER: AWS
    DOCKER_PASSWORD: "$AWS_ECR_PASSWORD"

当我添加“before_脚本”时,我得到以下结果:

inflating: aws/dist/cryptography-3.3.2-py3.9.egg-info/LICENSE  
  inflating: aws/dist/cryptography-3.3.2-py3.9.egg-info/WHEEL  
   creating: aws/dist/cryptography/hazmat/
   creating: aws/dist/cryptography/hazmat/bindings/
  inflating: aws/dist/cryptography/hazmat/bindings/_openssl.abi3.so  
$ ./aws/install
mkdir: cannot create directory ‘/usr/local/aws-cli’: Permission denied
Uploading artifacts for failed job
00:00
Uploading artifacts...
WARNING: gl-container-scanning-report.json: no matching files 

似乎它没有权限。有没有别的办法让它发挥作用?谢谢

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/132602
文章 [ 1 ]  |  最新文章 4 年前
sytech
Reply   •   1 楼
sytech    4 年前

这个 container_scanning 作业(默认情况下) uses the docker image registry.gitlab.com/security-products/container-scanning:4

您还可以看到此图像将其用户指定为 gitlab ,这对我来说意味着图像中的用户与您传统使用的大多数图像不同,默认情况下没有root权限。

因此,该用户将没有写入的权限 /usr/local/

你可以通过使用 sudo

- sudo ./aws/install

(或者,如您所述,您可以使用将安装定向到另一个不需要提升权限才能写入的位置。) -i 和 -b 安装程序的标志)。