fuz*_*zes 14 docker gitlab-ci gitlab-ci-runner
我使用 gitlab ci 来构建 docker 镜像,我想安装 python。当我构建时,以下是我的 gitlab-ci.yml:
image: docker:stable
stages:
- test
- build
before-script:
- apt install -y python-dev python pip
test1:
stage: test
script:
...
- pytest
build:
stage: build
- docker build -t $IMAGE_TAG .
- docker push $IMAGE_TAG
Run Code Online (Sandbox Code Playgroud)
但我的工作失败了
/bin/sh: eval: line : apt: not found
ERROR: Job failed: exit code 127
Run Code Online (Sandbox Code Playgroud)
我也试过 apt-get install 但结果是一样的。
我如何安装python?
小智 11
这实际上不是问题,但您可以说它由带有 Alpine 的包管理器提供,您正在使用图像:docker:stable 或任何诸如 tomcat 或 Django 之类的图像,它们在 Alpine Linux 上。尺寸最小。
image: docker:stable
stages:
- test
- build
before-script:
- apk add python python-dev python pip
test1:
stage: test
script:
...
- pytest
build:
stage: build
- docker build -t $IMAGE_TAG .
- docker push $IMAGE_TAG
Run Code Online (Sandbox Code Playgroud)
apk 是 Alpine Linux 包管理
小智 10
您看到的错误是因为 alpine docker 中不存在 apt\xe2\x80\x99t 。
\n\n这一行为我解决了这个问题:
\n\napk update && apk add python
| 归档时间: |
|
| 查看次数: |
11369 次 |
| 最近记录: |