[mongodb] Fix docker builds by removing apt-get and improving healthchecks#17507
Merged
shmsr merged 4 commits intoelastic:mainfrom Feb 23, 2026
Merged
[mongodb] Fix docker builds by removing apt-get and improving healthchecks#17507shmsr merged 4 commits intoelastic:mainfrom
shmsr merged 4 commits intoelastic:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes Docker image build failures in the MongoDB integration's test infrastructure caused by an expired GPG key in the mongodb-org.list repository file. The fix removes the problematic repository list file before running apt update and package installation.
Changes:
- Removes the mongodb-org.list file (which contains an expired GPG key) instead of just removing jessie-updates from sources.list
- Updates package installation to use netcat-openbsd instead of netcat
- Combines the removal and installation steps into a single RUN command for better Docker layer caching
Comments suppressed due to low confidence (1)
packages/mongodb/_dev/deploy/docker/Dockerfile:6
- The command should follow standard Dockerfile practices: use 'apt-get' instead of 'apt' for better stability in scripts, and use the '-y' flag instead of piping 'yes'. The recommended command would be: 'apt-get update && apt-get install -y netcat-openbsd'. The 'apt' command is meant for interactive use, while 'apt-get' is more stable for scripting contexts like Dockerfiles.
apt update && \
yes | apt install netcat-openbsd
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ealthchecks - The previous `apt-get update` was failing on old `mongo:5.0` images due to expired `mongodb-org.list` GPG keys. - By switching from `netcat` to native `mongo/mongosh` ping commands for the `HEALTHCHECK`, we no longer need to install `netcat-openbsd`. - This allows us to completely remove the `apt-get` installation step, which naturally avoids the expired GPG key issue altogether and dramatically speeds up image build times. - Furthermore, the `mongo/mongosh` healthcheck is much more robust as it guarantees the database is ready to accept queries, not just that the TCP port is listening. - Removes duplicate `creator/Dockerfile` and consolidates build configuration inside a single base `Dockerfile`. - Removes obsolete `version: '2.3'` from `docker-compose.yml` and uses YAML anchors (`x-mongodb-base`) for DRY configuration. - Adds default fallback volume path `./logs` for `SERVICE_LOGS_DIR`.
🚀 Benchmarks reportTo see the full report comment with |
💚 Build Succeeded
History
cc @shmsr |
This was referenced Feb 23, 2026
giorgi-imerlishvili-elastic
approved these changes
Feb 23, 2026
mykola-elastic
approved these changes
Feb 23, 2026
Contributor
mykola-elastic
left a comment
There was a problem hiding this comment.
LGTM
Backport to all active?
devamanv
approved these changes
Feb 23, 2026
Member
Author
This is integrations 😅 |
haetamoudi
pushed a commit
to haetamoudi/integrations
that referenced
this pull request
Feb 23, 2026
This was referenced Feb 24, 2026
Closed
This was referenced Feb 24, 2026
Closed
Closed
navnit-elastic
pushed a commit
to navnit-elastic/integrations
that referenced
this pull request
Mar 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed commit message
This PR fixes broken docker builds and improves the overall setup for the mongodb package.
Key improvements:
mongodb-org.listGPG key issue by removing theapt-get updatestep altogether. (bugfix, that caused CI failures)netcat-openbsdto check if the TCP port is listening, we now use the nativemongo(ormongosh) client to run apingcommand. This ensures the database is fully ready to accept queries, not just that the port is open.apt-getdependency installations, the docker image builds instantaneously.creator/Dockerfilewas removed. Bothmongodbandmongodb-logservices now use the singleDockerfileat the root.version: '2.3'attribute and implemented YAML anchors (x-mongodb-base) to reuse the common build config betweenmongodbandmongodb-logservices../logsfor theSERVICE_LOGS_DIRvolume mount, preventing the "blank string" warning and broken mounts when the variable isn't explicitly set.Checklist
changelog.ymlfile.Related issues