Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

1.5K
Visualizações
.gitlab-ci.yml error: "apk: command not found"

I have the following .gitlab-ci.yml file:

image: docker

services:
  - docker:dind

stages:
  - test
  - build
  - deploy

test:
  stage: test
  before_script:
    - apk add --update -y python-pip
    - pip install docker-compose
  script:
    - echo "Testing the app"
    - docker-compose run app sh -c "python manage.py test && flake8"

build:
  stage: build
  only:
    - develop
    - production
    - feature/deploy-debug-gitlab
  before_script:
    - apk add --update -y python-pip
    - pip install docker-compose
  script:
    - echo "Building the app"
    - docker-compose build

deploy:
  stage: deploy
  only:
    - master
    - develop
    - feature/deploy
    - feature/deploy-debug-gitlab
  before_script:
    - apk add --update -y python-pip
    - pip install docker-compose
  script:
    - echo "Deploying the app"
    - docker-compose up -d
  environment: production
  when: manual

When the Gitlab runner executes it, I get the following error:

$ apk add --update -y python-pip
bash: line 82: apk: command not found
ERROR: Job failed: exit status 1

How am I supposed to install apk? Or what image other than docker should I be using to run this gitlab-ci.yml file?

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

Well, it turns out I had two different runners: one marked as "shell executor" (Ubuntu) and the other marked as "docker executor“.

This error was being thrown out only when the Ubuntu runner was dispatching the job, since Ubuntu doesn´t come with apk.

I disabled the Ubuntu runner and solved the problem.

over 4 years ago · Santiago Trujillo Relatório

0

The alternative is to set your installation on step above test, as in this issue

image: docker:latest

services:
- docker:dind

before_script:
- apk add --update python-pip
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda