version: '3.1' services: my-mongo: image: my-mongo restart: always ports: - 27017:27017 environment: MONGO_INITDB_ROOT_USERNAME: ${DB_ADM_USER} MONGO_INITDB_ROOT_PASSWORD: ${DB_ADM_PASS} volumes: - ${HOME}/mongo_container/data/:/data/ mongo-express: image: mongo-express restart: always ports: - 8087:8081 environment: ME_CONFIG_MONGODB_ADMINUSERNAME: ${DB_ADM_USER} ME_CONFIG_MONGODB_ADMINPASSWORD: ${DB_ADM_PASS} ME_CONFIG_MONGODB_SERVER: my-mongo