Docker
Provided images
We provide three official Docker images:
- Production image
ghcr.io/ferretdb/ferretdb
. - Development image
ghcr.io/ferretdb/ferretdb-dev
. - All-in-one image
ghcr.io/ferretdb/all-in-one
.
The last one is provided for quick testing and experiments and is unsuitable for production use cases. It is documented in the FerretDB repository.
The development images contain the debug build of FerretDB with test coverage instrumentation, race detector, and other changes that make it more suitable for debugging problems. In general, the production image should be used since it is faster and smaller. The following instructions use it, but the development image could be used in exactly the same way.
Setup with Docker Compose
The following steps describe a quick local setup:
Store the following in the
docker-compose.yml
file:services:
postgres:
image: postgres
environment:
- POSTGRES_USER=username
- POSTGRES_PASSWORD=password
- POSTGRES_DB=ferretdb
volumes:
- ./data:/var/lib/postgresql/data
ferretdb:
image: ghcr.io/ferretdb/ferretdb
ports:
- 27017:27017
environment:
- FERRETDB_POSTGRESQL_URL=postgres://postgres:5432/ferretdb
networks:
default:
name: ferretdbpostgres
container runs PostgreSQL that would store data in the./data
directory on the host.ferretdb
runs FerretDB.Start services with
docker compose up -d
.If you have
mongosh
installed, just run it to connect to FerretDB. It will use credentials passed inmongosh
flags or MongoDB URI to authenticate to the PostgreSQL database. You'll also need to setauthMechanism
toPLAIN
. The example URI would look like:mongodb://username:password@127.0.0.1/ferretdb?authMechanism=PLAIN
See Authentication for more details.
If you don't have
mongosh
, run the following command to run it inside the temporary MongoDB container, attaching to the same Docker network:docker run --rm -it --network=ferretdb --entrypoint=mongosh mongo \
"mongodb://username:password@ferretdb/ferretdb?authMechanism=PLAIN"
You can improve that setup by:
- securing connections with TLS;
- adding backups.