This guide walks you through installing and running MongoDB Compass 1.28.4 inside a Docker container, with GUI support, and connected to a MongoDB 3.6 container on Ubuntu 24.04 LTS.
- Compass 1.28.4 is one of the last versions that supports MongoDB 3.6.
- Ubuntu 24.04 no longer includes
libgconf-2-4, which Compass depends on. - Docker allows isolating these older dependencies.
mkdir -p ~/databases/mongo3.6
docker run -d --name mongo3.6 \
-p 27017:27017 \
-v ~/databases/mongo3.6:/data/db \
mongo:3.6You can connect to this MongoDB instance via the Docker bridge network using 172.17.0.1 as the host.
Lets put a Dockerfile in a folder
$ mkdir $HOME/mongodbcompass1284
$ cd $HOME/mongodbcompass1284
Create a file named Dockerfile with the following contents:
$ nano Dockerfile
FROM debian:bullseye
ENV DEBIAN_FRONTEND=noninteractive
# Install dependencies
RUN apt-get update && apt-get install -y \
curl ca-certificates \
libgtk-3-0 libxss1 libasound2 libnss3 libx11-xcb1 libxcomposite1 libxdamage1 libxrandr2 \
libatk1.0-0 libatk-bridge2.0-0 libx11-6 libxcb1 libxext6 libxfixes3 \
&& rm -rf /var/lib/apt/lists/*
# Download and install MongoDB Compass 1.28.4 .deb
RUN curl -L -o /tmp/compass.deb https://downloads.mongodb.com/compass/mongodb-compass_1.28.4_amd64.deb \
&& apt-get update && apt-get install -y /tmp/compass.deb \
&& rm /tmp/compass.deb
# Entry point for Compass
ENTRYPOINT ["mongodb-compass", "--no-sandbox"]Then build the Docker image:
docker build -t compass-1284 .Make sure X11 apps from Docker can use your display:
xhost +local:dockerdocker run -it --rm \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
compass-1284MongoDB Compass should open! Now, try to connect, not to localhost, but to where your mongo is.
Then in Compass, connect to:
mongodb://172.17.0.1:27017
This IP is the default gateway from the container to the host (Docker bridge network).
This setup lets you use legacy MongoDB Compass 1.28.4 on modern systems, fully isolated, with GUI and network connectivity to MongoDB 3.6 running on the Docker host.