无法在Bitbucket Pipelines docker实例中执行lsb-release

时间:2016-10-27 00:28:16

标签: python bash docker lsb bitbucket-pipelines

我有一个看起来像这样的Bitbucket Pipelines yaml:

image:python:3.5.1

pipelines:
  branches:
    master:
      - step:
          script:
            - apt-get update
            - apt-get install lsb-release -y
            - curl --silent https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
            - VERSION=node_5.x
            - DISTRO="$(lsb-release -s -c)"
            - echo "deb https://deb.nodesource.com/$VERSION $DISTRO main" | tee /etc/apt/sources.list.d/nodesource.list
            - echo "deb-src https://deb.nodesource.com/$VERSION $DISTRO main" | tee -a /etc/apt/sources.list.d/nodesource.list
            - apt-get update
            - apt-get install nodejs -y
            - npm install
            - npm run build
            - python get-pip.py
            - pip install boto3==1.3.0
            - python s3_upload.py io-master.fromthiscomesthat.co.uk dist io-master

除了DISTRO="$(lsb-release -s -c)"失败之外,一切正常。找不到lsb-release可执行文件,即使它已在脚本中成功安装。我尝试了find / -name lsb-release,但这只会产生以下结果:

+ find / -name lsb-release
/usr/share/doc/lsb-release
/usr/share/bug/lsb-release 

......这不是很有用。

可执行文件在哪里?

1 个答案:

答案 0 :(得分:0)

lsb-release是包的名称,lsb_release是二进制文件的名称。

我是如何找到这个的:

  1. 在主机上安装了docker
  2. 获取泊坞窗图片并运行容器以在其中测试docker run -it --rm python:3.5.1 /bin/bash
  3. 使用lsb-release
  4. 安装apt-get update && apt-get install -y lsb-release
  5. 查看包dpkg -L lsb-release中的文件(**/bin目录中的文件是可执行文件)