skip to Main Content

After following the article "Run Docker commands in Bitbucket Pipelines" I came up with this sample pipeline I’m trying to build for a Python repository.

image: python:3.10-slim

pipelines:
  branches:
   '**':
     - step:
         name: Test Docker Commands
         runs-on:
            - 'self.hosted'
            - 'docker'
            - 'linux'
         services:
            - docker
         script:
            - docker version

definitions:
  services:
     docker:
        memory: 2048

But I get the following error:

bash: docker: command not found

I also tried to add the export DOCKER_BUILDKIT=1 but there were no improvements.

Is there something I’m missing or misunderstood?

2

Answers


  1. Chosen as BEST ANSWER

    I found the solution to my problem. There were two main issues:

    • Runner System: The runner needed to be based on 'Linux Docker'.
    • Version Update: My runner was left at version 1.384. Updating it to the latest version (2.4.0) resolved the issue, and the docker commands became available.

    Thank you, @N1ngu, for pointing me in the right direction!


  2.  image: python:3.10-slim
    

    There is no docker command inside python image. You have to install it inside the image, or use a docker:cli image.

    See dind – "docker-in-docker" documentation, see docker.hub docker images and tags. See default bitbucket pipelines image documentation, see https://hub.docker.com/r/atlassian/default-image/ .

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search