Docker using compose, configuration file with environment variables and creating a container, in addition the data are present on the local machine even after restart or re created the container :
- mongodb:latest
-
Expose port
- 12017
-
Volume (Note: check if in the docker configuration -> shared drivers, the units are enabled)
- Application database: ./docker/mongo/data -> /data/db
- Clone the repository using the command:
$ git clone https://github.com/jadilson12/docker-compose-mongo
- Enter the folder docker-compose-mongo copy the files
$ cp env-example .env
$ cp docker-compose.yml-example docker-compose.yml
- Run your container:
$ docker-compose up -d
- Access the container shell:
$ docker exec -it app-database sh
Give a ⭐️ if this project helped you!
Contributions, issues and feature requests are welcome!
Feel free to check issues page.
Jadilson Guedes jadilson12@gmail.com
License MIT https://jadilson12.mit-license.org/