dynamodb-local inside Gitlab CI
See original GitHub issueI 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:
[0KRunning with gitlab-runner 11.11.0-rc2 (7f58b1ec)
[0;m[0K on docker-auto-scale 0277ea0f
[0;msection_start:1557296045:prepare_executor
[0K[0KUsing Docker executor with image node:12 ...
[0;m[0KStarting service docker:dind ...
[0;m[0KPulling docker image docker:dind ...
[0;m[0KUsing docker image sha256:6204caf6c5927058f10fab0e4661b5f7a37d9a986a89b28a176a9958a0a5b7d3 for docker:dind ...
[0;m[0KWaiting for services to be up and running...
[0;m[0KPulling docker image node:12 ...
[0;m[0KUsing docker image sha256:c77f0d290562eefd2c9e5481cc1707f40a43d2dd5f7719384bd3b8f05699ffd7 for node:12 ...
[0;msection_end:1557296093:prepare_executor
[0Ksection_start:1557296093:prepare_script
[0KRunning on runner-0277ea0f-project-12215658-concurrent-0 via runner-0277ea0f-srm-1557295996-5afcffc7...
section_end:1557296098:prepare_script
[0Ksection_start:1557296098:get_sources
[0KInitialized empty Git repository in /builds/Meemaw/meshwatch-backend-core/.git/
[32;1mFetching changes...[0;m
[32;1mCreated fresh repository.[0;m
From https://gitlab.com/Meemaw/meshwatch-backend-core
* [new branch] master -> origin/master
[32;1mChecking out fb1e6645 as master...[0;m
[32;1mSkipping Git submodules setup[0;m
section_end:1557296100:get_sources
[0Ksection_start:1557296100:restore_cache
[0Ksection_end:1557296101:restore_cache
[0Ksection_start:1557296101:download_artifacts
[0K[32;1mDownloading artifacts for install_packages_run_linters (208940828)...[0;m
Downloading artifacts from coordinator... ok [0;m id[0;m=208940828 responseStatus[0;m=200 OK token[0;m=oi_pU5bU
section_end:1557296112:download_artifacts
[0Ksection_start:1557296112:build_script
[0K[32;1m$ DEBUG=testcontainers yarn test --runInBand --coverage[0;m
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:
- Created 4 years ago
- Comments:15 (6 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Meemaw I’ve verified this is fixed now in version
1.1.17
, could you confirm? Just need to changelocalhost
tocontainer.getContainerIpAddress()
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 theDOCKER_HOST
env variable, I’d need to check whattestcontainers-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.