使用通过Docker安装的Jenkins运行AWS Command Line Interface:找不到命令吗?

时间:2019-01-15 15:56:05

标签: docker jenkins aws-cli

从Jenkins管道运行aws时,出现以下错误消息:command not found-which aws返回command not found

另一方面,当从单个作业运行aws时,它可以工作-which aws返回/usr/local/bin/aws

您知道为什么会这样吗?

谢谢。

2 个答案:

答案 0 :(得分:1)

您仍然需要在docker容器中安装AWS CLI。

 # Swap to root user to install pip and aws cli then go back to jenkins user
USER root
RUN apt-get update
RUN apt install python3-pip -y
RUN pip3 install awscli --upgrade
USER jenkins

答案 1 :(得分:-1)

Look this link https://stackoverflow.com/a/42818261/8442153, or execute

# sudo -su jenkins
# aws configure