Docker/System Stats: Difference between revisions
From charlesreid1
No edit summary |
|||
| Line 47: | Line 47: | ||
</pre> | </pre> | ||
==mongodb== | ==mongo== | ||
===mongodb=== | |||
Link: https://charlesreid1.com:3000/docker/d-mongodb | Link: https://charlesreid1.com:3000/docker/d-mongodb | ||
| Line 57: | Line 59: | ||
The final docker run command is here: https://charlesreid1.com:3000/docker/d-mongodb/src/master/run_mongodb.sh | The final docker run command is here: https://charlesreid1.com:3000/docker/d-mongodb/src/master/run_mongodb.sh | ||
==mongo express== | ===mongo express=== | ||
Link: https://charlesreid1.com:3000/docker/d-mongoexpress | Link: https://charlesreid1.com:3000/docker/d-mongoexpress | ||
| Line 65: | Line 67: | ||
The final docker run command is here: https://charlesreid1.com:3000/docker/d-mongoexpress/src/master/run_stock.sh | The final docker run command is here: https://charlesreid1.com:3000/docker/d-mongoexpress/src/master/run_stock.sh | ||
==run mongo docker containers on boot== | ===run mongo docker containers on boot=== | ||
To run the mongo docker containers at boot, I created run scripts containing the docker run commands (with all flags setting up port mappings, etc.) | To run the mongo docker containers at boot, I created run scripts containing the docker run commands (with all flags setting up port mappings, etc.) | ||
Revision as of 07:01, 4 February 2018
netdata
Standalone netdata docker container: https://hub.docker.com/r/firehol/netdata/~/dockerfile/
(Note: this is the standard netdata repo https://github.com/firehol/netdata but the Dockerfile is conveniently embedded in there so it's picked up as a docker container)
The netdata container is am arm image, lightweight at 60 mb, and uses /host to connect to the host.
Not sure about the run script or the connection between the host and the container.
graphite
graphite container comes from graphiteapp docker image: https://hub.docker.com/r/graphiteapp/graphite-statsd/
Note that currently, the installed netstat instance (currently, an aptitude-installed instance of netdata) steps on the toes of this graphite container because port 8125 is open on the host machine.
To fix: slight modification of the port mappings in the docker run call.
Link: https://hub.docker.com/r/graphiteapp/graphite-statsd/
original Docker run call:
docker run -d\ --name graphite\ --restart=always\ -p 80:80\ -p 2003-2004:2003-2004\ -p 2023-2024:2023-2024\ -p 8125:8125/udp\ -p 8126:8126\ graphiteapp/graphite-statsd
Now, remap 8125 in the graphite container to 8124 on the host:
docker run -d\ --name graphite\ --restart=always\ -p 80:80\ -p 2003-2004:2003-2004\ -p 2023-2024:2023-2024\ -p 8124:8125/udp\ -p 8126:8126\ graphiteapp/graphite-statsd
mongo
mongodb
Link: https://charlesreid1.com:3000/docker/d-mongodb
mongodb is a nosql database and it runs on port 27017. The volume is run using the -v flag to create a mapping from the database's data directory to a folder on the host so that the data is persistent after the container goes away.
we have successfully set up a mongodb docker container to use a persistent data directory in /opt/mongodb and to start up on boot.
The final docker run command is here: https://charlesreid1.com:3000/docker/d-mongodb/src/master/run_mongodb.sh
mongo express
Link: https://charlesreid1.com:3000/docker/d-mongoexpress
mongo express is the web interface to mongodb, and runs on port 8081. this container is linked to the mongodb container and communicates with it via port 27017.
The final docker run command is here: https://charlesreid1.com:3000/docker/d-mongoexpress/src/master/run_stock.sh
run mongo docker containers on boot
To run the mongo docker containers at boot, I created run scripts containing the docker run commands (with all flags setting up port mappings, etc.)
This script does the following:
- List all docker processes and pass each one to docker rm to remove any old versions of the containers
- Sleep to let the removal finish
- Start the mongodb container
- Sleep to let mongodb start up
- Start the mongoexpress container
Many Bothans died to bring us these steps.
#!/bin/bash
#
# Start MongoDB container
# and MongoExpress container.
#
# This script should be made executable
# and called in /etc/rc.local
# by the desired user:
#
# su charles -c '/path/to/script'
# remove crusty processes
docker ps -qa | xargs -I% docker rm -f %
sleep 5;
# run mongodb
/home/charles/codes/docker/d-mongodb/run_mongodb.sh
sleep 5;
# run mongo express
/home/charles/codes/docker/d-mongoexpress/run_stock.sh
Next, add this script to the /etc/rc.local file to run it at boot:
su charles -c '/path/to/above/script.sh