version: '3.1' services: mongo: image: mongo environment: MONGO_INITDB_ROOT_USERNAME: root MONGO_INITDB_ROOT_PASSWORD: example ports: - 27017:27017 volumes: - ./db:/data/db mongo-express: image: mongo-express ports: - 8081:8081 environment: ME_CONFIG_MONGODB_ADMINUSERNAME: root ME_CONFIG_MONGODB_ADMINPASSWORD: example
![MongoDBデータ操作(DB, Collection, Document) - わくわくBank](https://cdn-ak-scissors.b.st-hatena.com/image/square/3f25445c417af3690c437a8bf4d9e56a1caa5abd/height=288;version=1;width=512/https%3A%2F%2Fwww.wakuwakubank.com%2Fwp-content%2Fuploads%2F784-server-mongodb-introduction_thumbnail.png)