正在运行带有android构建环境映像和ruby的管道

问题描述 投票:0回答:1

我正在使用以下yml文件

image: uber/android-build-environment:latest

pipelines:
  default:
    - step:
        caches:
          - bundler
        script: # Modify the commands below to build your repository.
          - apt-get update && apt-get install -y awscli
          - apt-get install rubygems
          - gem install bundler
          - bundle install
          - bundle exec fastlane test
          - bundle exec fastlane build
definitions:
  caches:
    bundler: ./vendor

请注意,我使用的是Android构建环境映像。

构建失败于

apt-get install ruby​​gems错误:

E:无法打开锁定文件/ var / lib / dpkg / lock-打开(13:权限E:无法锁定管理目录(/ var / lib / dpkg /),您是root吗?

因此,看起来构建脚本没有以超级用户身份运行。

如果我尝试使用sudo,它将失败并显示错误

sudo:不存在tty且未指定askpass程序

我应该怎么做才能在Android构建环境映像中运行ruby gem?

android ruby bitbucket-pipelines
1个回答
0
投票
uber/android-build-environment:latest使用非root用户,该用户无权运行某些命令,例如apt-get。您应该使用root用户重建映像,或临时将用户更改为root。在您的Dockerfile中添加:

USER root install/updates USER solr

在此处How to install new packages into non-root Docker Container?中查看有关此问题的更多详细信息

P.S。您无需以root用户身份运行管道。如果您在docker容器内的根目录下运行,则可以安装依赖项。

© www.soinside.com 2019 - 2024. All rights reserved.