user3465651
user3465651

Reputation: 764

bitbucket pipeline with docker container

I have a project that I am building with maven. The test case uses test containers to start up a MS-SQLserver instance. The pipeline is currently failing.

The reason being the pipleline image I am using is:

image: maven:3.6.0

Which is devoid of docker and the sqlserver image.

My question is:

Do I create my own image with java + maven + docker + sqlserver and use that in the pipeline file

or

Just have commands in the pipeline file to install what I need? I would assume this would be the slower options WRT build time


Example of bitbucket pipeline fail with testcontainers ryuk enabled:

2019-09-09 07:21:22.719  WARN 416 --- [containers-ryuk] o.testcontainers.utility.ResourceReaper  : Can not connect to Ryuk at localhost:32768
java.net.SocketException: Broken pipe (Write failed)
    at java.net.SocketOutputStream.socketWrite0(Native Method) ~[na:1.8.0_222]
    at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:111) ~[na:1.8.0_222]
    at java.net.SocketOutputStream.write(SocketOutputStream.java:134) ~[na:1.8.0_222]
    at org.testcontainers.utility.ResourceReaper$FilterRegistry.register(ResourceReaper.java:380) ~[testcontainers-1.11.2.jar:na]

Upvotes: 1

Views: 1938

Answers (2)

Babatunde Adeyemi
Babatunde Adeyemi

Reputation: 14448

You can get TestContainers to work with your Bitbucket Pipelines by disabling Ryuk. You also need to add docker as a service in your script as follows:

image: atlassian/default-image:2

pipelines:
  default:
    - step:
        script:
          - export TESTCONTAINERS_RYUK_DISABLED=true
          # Your commands should come after setting the environment variable above
          # ...
          # ...
        services:
          - docker
definitions:
  services:
    docker:
      memory: 2048

Detailed information regarding this is provided here.

Upvotes: 3

bsideup
bsideup

Reputation: 3073

You need to add "docker" service to your pipeline and disable Ryuk.

Upvotes: 1

Related Questions