Skip to content

mongo:latest image is missing mongo binary #558

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bernermic opened this issue Aug 25, 2022 · 12 comments · Fixed by #559
Closed

mongo:latest image is missing mongo binary #558

bernermic opened this issue Aug 25, 2022 · 12 comments · Fixed by #559
Labels

Comments

@bernermic
Copy link

bernermic commented Aug 25, 2022

Hi,

as of today we face an issue with the mongo command.

Steps to reproduce:

  • Start a mongodb:
    • docker run -it --rm --name mongo mongo:latest mongod
  • Execute command mongo in the started mongodb
    • docker exec -it mongo mongo
      This delivers the following error:
      OCI runtime exec failed: exec failed: unable to start container process: exec: "mongo": executable file not found in $PATH: unknown

With version 5.0 the mongo command is working as expected.

Expected

mongo command is still working

Further info

We use a project called testcontainers which starts a mongo:latest and connects with command mongo. This fails with the explained behaviour.
Related to this: testcontainers/testcontainers-java#5768

Best
Michael

@wglambert wglambert added the question Usability question, not directly related to an error with the image label Aug 25, 2022
@wglambert
Copy link

#553 (comment)

mongo is literally gone now

You can use mongosh instead

$ docker run -d --name mongo mongo:6
4298382d6a44e1e04d7bdceaf1f55d0e778858c6c63cb9e401dc68007f60172b

$ docker exec -it mongo mongosh
Current Mongosh Log ID: 63079e8c19747686a983a543
Connecting to:          mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.5.4
Using MongoDB:          6.0.1
Using Mongosh:          1.5.4

For mongosh info see: https://docs.mongodb.com/mongodb-shell/


To help improve our products, anonymous usage data is collected and sent to MongoDB periodically (https://www.mongodb.com/legal/privacy-policy).
You can opt-out by running the disableTelemetry() command.

------
   The server generated these startup warnings when booting
   2022-08-25T16:08:31.154+00:00: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine. See http://dochub.mongodb.org/core/prodnotes-filesystem
   2022-08-25T16:08:31.733+00:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
   2022-08-25T16:08:31.734+00:00: /sys/kernel/mm/transparent_hugepage/enabled is 'always'. We suggest setting it to 'never'
   2022-08-25T16:08:31.734+00:00: vm.max_map_count is too low
------

------
   Enable MongoDB's free cloud-based monitoring service, which will then receive and display
   metrics about your deployment (disk utilization, CPU, operation statistics, etc).

   The monitoring data will be available on a MongoDB website with a unique URL accessible to you
   and anyone you share the URL with. MongoDB may use this information to make product
   improvements and to suggest MongoDB products and deployment options to you.

   To enable free monitoring, run the following command: db.enableFreeMonitoring()
   To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
------

test>

@scottbelden
Copy link

If it is gone then should the docker-entrypoint.sh scripts be updated? Currently they have this line:

mongo --norc --nodb --quiet --eval "load('/js-yaml.js'); printjson(jsyaml.load(cat($(_js_escape "$configPath"))))" > "$jsonConfigFile"

Which shows up in my docker logs as /usr/local/bin/docker-entrypoint.sh: line 199: mongo: command not found

@wglambert wglambert added Issue and removed question Usability question, not directly related to an error with the image labels Aug 25, 2022
@yosifkit
Copy link
Member

Testing a fix since mongosh doesn't have all the same available javascript functions as mongo did.

@cbdonohue
Copy link

is the mongo binary going away?

@tianon
Copy link
Member

tianon commented Aug 25, 2022

From MongoDB upstream's perspective, it's been "going away" since they introduced mongosh, and in 6.0, it's "gone" 😬 ❤️

hsluoyz pushed a commit to node-casbin/mongo-changestream-watcher that referenced this issue Aug 26, 2022
* ci(docker-entrypoint.sh): change mongo commands into mongosh

docker-library/mongo#558

fix #2

* test(watcher.test.ts): add callbackStreamCloseEvent attribute to a test
trentm added a commit to elastic/apm-agent-nodejs that referenced this issue Sep 19, 2022
… healthcheck

With MongoDB 6 containers (released in the last week), the `mongo`
binary is gone, replaced by `mongosh`.
See docker-library/mongo#558

Our tests were using `mongo:latest`. For now let's lock to mongo:5 and
then have a separate issue for updating container versions for testing.
trentm added a commit to elastic/apm-agent-nodejs that referenced this issue Sep 19, 2022
… healthcheck (#2936)

With MongoDB 6 containers (released in the last week), the `mongo`
binary is gone, replaced by `mongosh`.
See docker-library/mongo#558

Our tests were using `mongo:latest`. For now let's lock to mongo:5 and
then have a separate issue for updating container versions for testing.
@pankaj485
Copy link

I'm following some old videos on docker and this error really bothered me. Finally I got to interact with mongodb shell. Leaving a comment just to say thank you :)

@jokereven

This comment was marked as spam.

@aogilvie
Copy link

Does anyone know the earliest compatibility of mongoDB for which we can use mongosh?

Nothing is mentioned in the official docs - https://www.mongodb.com/docs/mongodb-shell/
Or the repository - https://github.com/mongodb-js/mongosh

@yosifkit
Copy link
Member

Looks like 5.0 is the first to have mongosh.

$ docker run -it --rm mongo:4.2 mongosh
Unable to find image 'mongo:4.2' locally
4.2: Pulling from library/mongo
456d651ccb27: Pull complete 
0d873b46166f: Pull complete 
b700537f311e: Pull complete 
8ba0f53e4854: Pull complete 
80b58c92c83f: Pull complete 
f4ed2f74d01b: Pull complete 
0a2bd86063a1: Pull complete 
e17a773a5f37: Pull complete 
4855607e00c3: Pull complete 
Digest: sha256:c7686ce0243cdc5eab7090c871a126d9c85c01f45a8395ffe3a352934ddd0570
Status: Downloaded newer image for mongo:4.2
/usr/local/bin/docker-entrypoint.sh: line 418: exec: mongosh: not found
$ docker run -it --rm mongo:4.4 mongosh
Unable to find image 'mongo:4.4' locally
4.4: Pulling from library/mongo
7608715873ec: Already exists 
aa7638a79c68: Pull complete 
6edb8e32447e: Pull complete 
9b078a16e980: Pull complete 
a09083ae9827: Pull complete 
8eafcd88aa89: Pull complete 
7d81a4f8c99b: Pull complete 
d248a55d605e: Pull complete 
19bc9dacc663: Pull complete 
Digest: sha256:164c3f8dd6c81f95346c478e7cc447a58804cb661c623d542f416221cd6c037c
Status: Downloaded newer image for mongo:4.4
/usr/local/bin/docker-entrypoint.sh: line 418: exec: mongosh: not found
$ docker run -it --rm mongo:5.0 mongosh
Unable to find image 'mongo:5.0' locally
5.0: Pulling from library/mongo
7608715873ec: Already exists 
aa7638a79c68: Already exists 
6edb8e32447e: Already exists 
9b078a16e980: Already exists 
a09083ae9827: Already exists 
6d64b6b8a202: Pull complete 
8e34d62e5cec: Pull complete 
439b8e6e66a4: Pull complete 
8178acfc9a68: Pull complete 
Digest: sha256:6a40ccbb4b6ad30a3602c9eff982f1aec828e78279aeb7c813f9f6d1cec4571e
Status: Downloaded newer image for mongo:5.0
Current Mongosh Log ID:	63fcf14815a57edbaf2edd65
Connecting to:		mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.7.1
MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017

@tianon
Copy link
Member

tianon commented Mar 3, 2023

https://github.com/mongodb-js/mongosh/blob/9cf53bc336c79e505cf034bf5e6f3b3b3796cf25/package.json#LL125C6-L125C6 specifies version 5.1.0 of the mongodb Node.js library (https://www.npmjs.com/package/mongodb), which is probably what determines the underlying compatibility level (but realistically, you'll probably just have to run some tests to figure out what the lower limit really is in practice).

Stefano-Gasco added a commit to NozomiNetworks/cti-taxii-server that referenced this issue Jun 20, 2023
Mongodb now requires mongoose command: docker-library/mongo#558
@ale900522

This comment was marked as off-topic.

@bernermic
Copy link
Author

bernermic commented Jan 6, 2024

@ale900522 You are using an older version which doesn’t have mongosh.
You can use mongo instead.

PeterEinberger pushed a commit to fpm-git/apm-agent-nodejs that referenced this issue Aug 20, 2024
… healthcheck (elastic#2936)

With MongoDB 6 containers (released in the last week), the `mongo`
binary is gone, replaced by `mongosh`.
See docker-library/mongo#558

Our tests were using `mongo:latest`. For now let's lock to mongo:5 and
then have a separate issue for updating container versions for testing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants