Docker
From Hawk Wiki
Revision as of 05:33, 24 December 2018 by Hall (Talk | contribs) (→Docker remove all stopped containers)
Contents
Docker socks5 proxy and Auto Restart
run on port 21080
docker pull wernight/dante docker run -dit --restart unless-stopped -p 21080:1080 wernight/dante
Docker mongodb
docker run -d -p 29017:27017 -v /data/db:/data/db -v /etc/mongod.conf:/etc/mongod.conf mongo:3.6.9-stretch --directoryperdb
Docker remove all stopped containers
docker container rm $(docker container ls -q)
docker check ip
docker inspect --format '{{ .NetworkSettings.IPAddress }}' mongodbmycompany2
docker replica with mongodb
docker run -d --name ${CLUSTER_NAME}1 -p 29017:27017 -v /data/$CLUSTER_NAME/db:/data/db -v /data/$CLUSTER_NAME/configData:/configData $IMAGE --directoryperdb --auth --replSet $CLUSTER_NAME --keyFile /mongo-config/mongo-keyfile --storageEngine wiredTiger rs.initiate() cfg = rs.conf() cfg.members[0].host = "hostname:27017" rs.reconfig(cfg) rs.add("hostname2:27017") rs.add("hostname3:27017")