我正在尝试在基于高山的dind:latest
图像中安装azure-cli。
对于上下文,我想用它连接到AKS并通过Gitlab将应用程序部署到Kubernetes。
在我的gitlab-ci.yml
文件中,我从
image: docker:latest
services:
- docker:dind
然后我尝试安装azure-cli
deploy-to-k8s--dev: # k8s namespace "dev"
stage: deploy-to-k8s
# image: microsoft/azure-cli
script:
# I need the azure cli in the dind:latest container
# so install bash,curl and finally the cli
- apk update
- apk upgrade
- apk add bash
- apk add --no-cache curl
- curl -L https://aka.ms/InstallAzureCli | bash
- az
我收到以下错误
$ curl -L https://aka.ms/InstallAzureCli | bash
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 167 100 167 0 0 167 0 0:00:01 --:--:-- 0:00:01 644
100 1367 100 1367 0 0 1367 0 0:00:01 --:--:-- 0:00:01 1367
mktemp: Invalid argument
ERROR: Job failed: error executing remote command: command terminated with non-zero exit code: Error executing in Docker Container: 1
这是我第一次尝试使用Alpine Linux,我不知道它是如何构建的以及它使用的工具......
有没有人有任何建议?
修改
根据接受的答案,这是最终的代码
deploy-to-k8s--dev: # k8s namespace "dev"
stage: deploy-to-k8s
script:
# I need the azure cli in the dind:latest container
# so install bash,curl and finally the cli
- apk update
- apk upgrade
- apk add bash make py-pip
- apk add --virtual=build gcc libffi-dev musl-dev openssl-dev python2-dev
- pip install azure-cli
- apk del --purge build
- az -h
答案 0 :(得分:3)
这帮助我了解了基于阿尔卑斯山的图像
apk更新, apk添加bash py-pip, apk添加--virtual = build gcc libffi-dev musl-dev openssl-dev python- dev, pip安装azure-cli, apk del --purge build