도커 기본 정리

기본 사항  :  서비큐라 기술 블로그 <링크>

 

Cloud Setting

# Start docker service
systemctl start docker

# Enable docker service to start with OS on reboots
systemctl enable docker

# Verify docker service
systemctl status docker

Deploy MongoDB

# pull mongodb image
docker pull mongo:3.2

# run mongodb container
docker run -d --restart=always \
-v /root/database/:/data/db \
--name mongodb \
mongo:3.2 mongod --smallfiles --nohttpinterface --replSet rs0

-d : background
–restart : when crash > restart the container always.
-v /root/database/:/data/db :  / root / database 에 모든 DB 컬렉션 저장.
–name : 이름 지정. 링크할 이름.
mongod –smallfiles ~~~ : 몽고 데몬을 small files 로 지정. http disable, run as replica set, 확장과 관련. 몽고 클러스터링, meteor oploger configuration 관련.

# configure replica set, create oplog user
docker exec -it mongodb mongo

에러 발생
Error response from daemon: Container 896-blablabla is restarting, wait until the container is running

 



# mongo console, ..
> use admin
> rs.initiate()
> db.createUser({  // 붙여서..
  user: "oplogger", 
  pwd: "master", 
  roles: [{role: "read", db: "local"}]
})

 

 

 

Advertisements