question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dynamodb-local inside Gitlab CI

See original GitHub issue

I can’t get amazon/dynamodb-local image work inside Gitlab CI. Note that it works locally without any problems. I haven’t tried if this works in testcontainers-java, cc @rnorth

I’m using CI settings from docs.

My .gitlab-ci.yml:

image: node:12

stages:
  - prepare
  - test

# DinD service is required for Testcontainers
services:
  - docker:dind

variables:
  DOCKER_HOST: 'tcp://docker:2375'
  DOCKER_DRIVER: overlay2

install_packages_run_linters:
  stage: prepare
  script:
    - yarn install
    - yarn lint
  artifacts:
    expire_in: 1 hour
    paths:
      - ./node_modules

test:unit:
  stage: test
  script:
    - DEBUG=testcontainers yarn test --runInBand --coverage
  coverage: '/All files[^|]*\|[^|]*\s+([\d\.]+)/'
  dependencies:
    - install_packages_run_linters

I’m setting up container like this:

const startedContainer = new GenericContainer("amazon/dynamodb-local").withExposedPorts(8000).start()

Relevant CI output:

Running with gitlab-runner 11.11.0-rc2 (7f58b1ec)
  on docker-auto-scale 0277ea0f
section_start:1557296045:prepare_executor
Using Docker executor with image node:12 ...
Starting service docker:dind ...
Pulling docker image docker:dind ...
Using docker image sha256:6204caf6c5927058f10fab0e4661b5f7a37d9a986a89b28a176a9958a0a5b7d3 for docker:dind ...
Waiting for services to be up and running...
Pulling docker image node:12 ...
Using docker image sha256:c77f0d290562eefd2c9e5481cc1707f40a43d2dd5f7719384bd3b8f05699ffd7 for node:12 ...
section_end:1557296093:prepare_executor
section_start:1557296093:prepare_script
Running on runner-0277ea0f-project-12215658-concurrent-0 via runner-0277ea0f-srm-1557295996-5afcffc7...
section_end:1557296098:prepare_script
section_start:1557296098:get_sources
Initialized empty Git repository in /builds/Meemaw/meshwatch-backend-core/.git/
Fetching changes...
Created fresh repository.
From https://gitlab.com/Meemaw/meshwatch-backend-core
 * [new branch]      master     -> origin/master
Checking out fb1e6645 as master...

Skipping Git submodules setup
section_end:1557296100:get_sources
section_start:1557296100:restore_cache
section_end:1557296101:restore_cache
section_start:1557296101:download_artifacts
Downloading artifacts for install_packages_run_linters (208940828)...
Downloading artifacts from coordinator... ok        id=208940828 responseStatus=200 OK token=oi_pU5bU
section_end:1557296112:download_artifacts
section_start:1557296112:build_script
$ DEBUG=testcontainers yarn test --runInBand --coverage
yarn run v1.15.2
warning package.json: No license field
$ tsdx test --verbose --runInBand --coverage
2019-05-08T06:15:26.975Z testcontainers Pulling image: amazon/dynamodb-local:latest
2019-05-08T06:15:44.045Z testcontainers Creating container for image: amazon/dynamodb-local:latest
2019-05-08T06:15:44.875Z testcontainers Starting container with ID: 32d5a7fed1d39799e6093fa46c52e8901156043e3b1bdf2bedd937d486133ff9
2019-05-08T06:15:46.372Z testcontainers Waiting for host port :39113
2019-05-08T06:15:46.376Z testcontainers Waiting for internal port :8000
FAIL test/monitoring-service.spec.ts (72.17s)
  MonitoringService
    with DynamoStorage
      bookmarkMonitor
        ✕ should_bookmarkMonitor_when_monitorIdPassed (14ms)
        ✕ should_return404_when_bookmarkMonitorWithRandomId
      deleteMonitor
        ✕ should_deleteMonitor__when_newlyCreatedMonitorParamsPassed (1ms)
        ✕ should_return404_when_deleteMonitorWithRandomId
      getMonitorsByScheduler
        ✕ should_getEmptyCollection_when_searchByRandomScheduler (1ms)
        ✕ should_getMonitors_when_searchByTestScheduler
      getMonitors
        ✕ should_getEmptyCollection_when_searchByRandomUserId
        ✕ should_getTestMonitors_when_searchByTestUserId (1ms)
      createMonitor
        ✕ should_createNewMonitor_when_createMonitorPayloadPassed
        ✕ should_returnBoomWithFieldError_when_invalidCreateMonitorPayloadPassed
        ✕ should_returnBoomWithFieldErrors_when_emptyObjectPassed (1ms)
      updateMonitor
        ✕ should_updateMonitor_when_updateMonitorPayloadIsPassed
        ✕ should_returnBoomWithFieldError_when_createMonitorPayloadPassed (1ms)

  ● MonitoringService › with DynamoStorage › bookmarkMonitor › should_bookmarkMonitor_when_monitorIdPassed

    Port :39113 not bound after 40000ms
```

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
cristianrgrecocommented, May 12, 2019

@Meemaw I’ve verified this is fixed now in version 1.1.17, could you confirm? Just need to change localhost to container.getContainerIpAddress()

1reaction
cristianrgrecocommented, May 8, 2019

I can confirm that amazon/dynamodb-local works locally.

I assume then that the issue is related to docker in docker, and that testcontainers-node is not using the correct socket in this case. I see you’ve set the DOCKER_HOST env variable, I’d need to check what testcontainers-java does with it. Possibly it’s as simple as using that value as the socket instead of the default one if it is present.

Read more comments on GitHub >

github_iconTop Results From Across the Web

GitLab CI: how to connect to the docker container started in ...
The slim and simple way is to use the local DynamoDB as service . With this script, local DynamoDB will be accessible via...
Read more >
Can Gitlab Auto DevOps provide an aws/dynamodb-local ...
I'm using an aws/dynamodb-local Docker container for use during local ... include: - template: Auto-DevOps.gitlab-ci.yml test: stage: test ...
Read more >
A Complete Spring Boot Microservice Build Pipeline using ...
The project uses GitLab CI to build and deploy the application, ... endpoint: http://dynamodblocal:8000/ specified in the application-CI.yml ...
Read more >
Alan Mangroo / GitLabCIDemo · GitLab
Run Dynamo DB Local ... If running locally you can use a local DynamoDB running in Docker. Start the instance as follows. Once...
Read more >
Serverless common issues and errors - Juan Pallarès Garbí
When configuring Serverless to be deployed from Gitlab CI/CD. ... To configure the deployment to sandbox and to production AWS in custom ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found