도커 mongo db, mongo db express 연동하기(볼륨생성, 네트워크 구성)
1. 도커 구성도
정확한 관계는 애매하긴한데 대충 이렇다.
2. 사용 컨테이너
3. 컨테이너간 커뮤니케이션
4. 도커 네트워크 설정
5. 데이터 지속성을 위한 volume 생성
WARNING (Windows & OS X): When running the Linux-based MongoDB images on Windows and OS X, the file systems used to share between the host system and the Docker container is not compatible with the memory mapped files used by MongoDB (docs.mongodb.org and related jira.mongodb.org bug). This means that it is not possible to run a MongoDB container with the data directory mapped to the host. To persist data between container restarts, we recommend using a local named volume instead (see docker volume create). Alternatively you can use the Windows-based images on Windows.
The Docker documentation is a good starting point for understanding the different storage options and variations, and there are multiple blogs and forum postings that discuss and give advice in this area. We will simply show the basic procedure here for the latter option above:
Create a data directory on a suitable volume on your host system, e.g.
/my/own/datadir.Start your
mongocontainer like this:$ docker run --name some-mongo -v /my/own/datadir:/data/db -d mongo
6. 실행
mongodb 컨테이너 실행 명령어 : powershell 에서 입력하면 됨
docker run -d --network mongo-net -p 27017:27017 -v mongo-vol --name mongodb -e MONGO_INITDB_ROOT_USERNAME=admin -e MONGO_INITDB_ROOT_PASSWORD=admin mongo
mongo-express 컨테이너 실행 명령어 :
docker run -d --network mongo-net --name mongo-express -p 8081:8081 -e ME_CONFIG_OPTIONS_EDITORTHEME="ambiance" -e ME_CONFIG_MONGODB_SERVER="mongodb" -e ME_CONFIG_MONGODB_ADMINUSERNAME="admin" -e ME_CONFIG_MONGODB_ADMINPASSWORD="admin" mongo-express


댓글
댓글 쓰기