在bitbucket-pipeline中获取“sudo:command not found”错误

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

在我的bitbucket-pipelines.yml文件中,我有这个:

  - step:
      image: python:3.7.2-stretch
      name: upload to s3
      script:
        - export S3_BUCKET="elasticbeanstalk-us-east-1-133233433288"
        - export VERSION_LABEL=$(cat VERSION_LABEL)
        - sudo apt-get install -y zip # required for packaging up the application
        - pip install boto3==1.3.0 # required for upload_to_s3.py
        - zip --exclude=*.git* -r /tmp/artifact.zip . # package up the application for deployment
        - python upload_to_s3.py # run the deployment script

但是当我在Bitbucket中运行此管道时,我收到一个错误,输出结果如下:

+ sudo apt-get install -y zip
bash: sudo: command not found

为什么不知道sudo是什么意思?所有Linux机器都不常见吗?

python docker bitbucket-pipelines docker-image
2个回答
1
投票

当在env $ PATH中配置的文件夹中找不到二进制文件时,在stderr中打印“command not found”错误

首先你需要找出它是否存在:

find /usr/bin -name "sudo"

如果你发现二进制文件尝试设置PATH变量:

export PATH=$PATH:/usr/bin/ 

然后尝试再次运行sudo。


0
投票

不,sudo无处不在。

但无论如何,你不必费心。运行图像时,你是root,所以你可以简单地运行apt-get而无需考虑权限。

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