Containerized Rust app that returns all Mongo's databases as a HTTP service
$ COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose up -d --build
$ curl http://localhost:8080
Databases:
- admin
- config
- local
Rust code is in main.rc file.
The HTTP service is listening on TCP 8080, on 0.0.0.0.
Rust is getting the Mongo URI from the MONGODB_URI
environment variable, placed in .env
The containers are deployed using docker-compose with BuildKit, using multi-stage builds for Rust. See Dockerfile
Check that the containers are up & running:
$ docker-compose ps
Testing the mongo connection after running the docker-compose up
command from "How to run":
$ mongo 127.0.0.1:27017
Connect to one of the containers:
$ docker exec -ti mongo /bin/bash
$ docker-compose stop
$ docker-compose rm