[英]apt-get not found in circleci pipeline (ubuntu)
目的:試圖通過circleci管道獲取機器的公共ip
我使用的代碼:
version: 2.1
orbs:
jq: circleci/jq@2.2.0
executors:
my-executor-terraform:
docker:
- image: docker.mirror.hashicorp.services/hashicorp/terraform:light
working_directory: /home/circleci/workingfile
jobs:
findpublicip:
executor: my-executor-terraform
steps:
- checkout
- run:
name: get ip to add to azure storage account
command: |
apt-get install -y sudo
sudo apt-get install curl
ip=$(curl ifconfig.me)
echo $ip
workflows:
example-workflow:
jobs:
- findpublicip
我得到的錯誤:
#!/bin/sh -eo pipefail
apt-get install -y sudo
sudo apt-get install curl
ip=$(curl ifconfig.me)
echo $ip
/bin/sh: apt-get: not found
Exited with code exit status 127
CircleCI received exit code 127
circleci 使用的虛擬機:
Build-agent version 1.0.133815-bc3df9c1 (2022-07-26T23:08:57+0000)
System information:
Server Version: 20.10.16
Storage Driver: overlay2
Backing Filesystem: xfs
Cgroup Driver: cgroupfs
Cgroup Version: 1
Kernel Version: 5.13.0-1023-aws
Operating System: Ubuntu 20.04.4 LTS
OSType: linux
Architecture: x86_64
Starting container docker.mirror.hashicorp.services/hashicorp/terraform:light
image is cached as docker.mirror.hashicorp.services/hashicorp/terraform:light, but refreshing...
light: Pulling from hashicorp/terraform
Digest: sha256:7cb0feb2b2c9839830a5be18f266d417bc4619f9eade9a326b019a0886c60a01
Status: Image is up to date for docker.mirror.hashicorp.services/hashicorp/terraform:light
docker.mirror.hashicorp.services/hashicorp/terraform:light:
using image hashicorp/terraform@sha256:7cb0feb2b2c9839830a5be18f266d417bc4619f9eade9a326b019a0886c60a01
pull stats: Image was already available so the image was not pulled
time to create container: 627ms
你能幫忙找到這里缺少的東西嗎? Circleci 使用基於 ubuntu 的 vm 來執行工作流。 我嘗試使用apt-get
安裝,但它說找不到apt-get
解決方案是使用apk add curl
而不是apt or apg-get
因為 runner vm 基於 alpine docker 圖像。 希望這有助於其他面臨類似問題的人確定您使用的是哪種類型的 linux 風味
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.