0

I am adding Testcontainers to my integration tests. Locally everything works fine. To let it run on my Bitbucket Pipelines, I created following (simplified) bitbucket-pipeline.yml:

image: maven:3.6.1

pipelines:
  default:
    - step:
      caches:
        - maven
      script:
        - export TESTCONTAINERS_RYUK_DISABLED=true
        - mvn -B verify
  branches:
    master:
     - step:
       caches:
         - maven
       services:
         - docker
       script:
         - ..
definitions:
  services:
    docker:
      memory: 2048

But when the pipeline starts running and the tests are executed, the docker service seems non existent:

Container startup failed
org.testcontainers.containers.ContainerLaunchException: Container startup failed
Caused by: org.testcontainers.containers.ContainerFetchException: Can't get Docker image: RemoteDockerImage(imageName=postgres:12.4, imagePullPolicy=DefaultPullPolicy())
Caused by: java.lang.IllegalStateException: Could not find a valid Docker environment. Please see logs and check configuration
Jacob van Lingen
  • 8,989
  • 7
  • 48
  • 78
  • Could you add the whole log section with that exception, please? Also, do you know how is docker env set up in bitbucket? Like is it connecting to remote or local docker daemon. – Vitaly Chura Sep 15 '20 at 12:23

1 Answers1

1

The answer is quite embarrassing. I forgot to add the

services:
     - docker

part to the default pipeline. So, as the logging showed, there was no docker service running for the non 'master' branches.

Jacob van Lingen
  • 8,989
  • 7
  • 48
  • 78