I tried to test whether the URL of MongoDB (client connection string) is correct in the server, it uses Kubernetes with alpine docker, when I tried to install clients, it shows:

bash-5.0# apk add mongodb-client
ERROR: unsatisfiable constraints:
  mongodb-client (missing):
    required by: world[mongodb-client]
bash-5.0# apk add  mongodb-tools 
ERROR: unsatisfiable constraints:
  mongodb-tools (missing):
    required by: world[mongodb-tools]

How to install MongoDB-client only in alpine? usually, I use apk add MySQL-client in but what's the MongoDB client only package?

2 Answers 2


Found easiest way using NodeJS (easier than with Ruby or others)

apk add nodejs
apk add npm
npm install mongo

then you can connect as usual:

const {MongoClient} = require('mongodb');
let c = (new MongoClient('mongodb://user:pass@host:port/dbname?connectTimeoutMS=1000&wtimeoutMS=1000')).connect()

This worked for me within an Alpine container:

/ # echo http://dl-cdn.alpinelinux.org/alpine/v3.6/main >> /etc/apk/repositories
/ # echo http://dl-cdn.alpinelinux.org/alpine/v3.6/community >> /etc/apk/repositories
/ # apk add mongodb mongodb-tools
/ # mongo mongodb://MY-HOST:27017
  • mongodb is still available in Alpine Linux 3.9.
    – x-yuri
    Oct 25, 2022 at 4:55
  • this worked for me, thanks a lot mate,
    – B3ns44d
    Mar 9, 2023 at 11:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .