Dockermon is a Docker Host Monitor and Management system. It runs from a Docker Image as a container and communicates with the host via socket / HTTP connection. This project also has a Companion Node/Nest Dockermon Host Launcher - Mac OS App that runs to assist in managing docker by launching Finder, Terminal (attach and logs), VS Code and more.
The Docker Hub Image webfreakeric/dockermon runs self contained and monitors your Docker via the Docker Engine API v1.41 through Sockets and HTTP requests.
Dockermon has worker jobs that collect stats for analyzing your containers. There's an intuitive interface and backend API that allows you to create, maintain, monitor, manage and do just about anything you need with Docker containers, images, volumes, networks, and various aspects of your Docker setup. Multi and Remote host control and monitoring is also possible!
Dockermon provides you with a blazing fast React/NextJS web interface to launch manage and view your docker system. Through the NestJS Host Companion included here, the web interface creates a socket connection and launches commands on your local machine. See Host Launcher section later.
Read more:
Start the Docker Engine. Tune your settings. You do not need to do anything with Node at this point.
The first step is to start off in terminal in a directory and clone this repo as follows:
git clone https://github.com/drumfreak/dockermon.git
cd dockermon
cp .env.sample .env
Now you've got the code. Let's do something with it.
The easiest way setup your dockermon container is to git clone the repo as mentioned earlier and run docker-compose. If you've followed the steps so far, you have the repo and are ready.
The default settings are for Mac OS and Linux. You will need to modifiy your
DOCKERMON_DOCKER_LOCAL_SOCKETin the .env if you're using Windows.
Dockermon will expose the following ports. However, MySQL, Redis, and other service ports will be closed and only used internally.
| Port | Service |
|---|---|
| 3800 | Dockermon Frontend Web Port http://localhost:3800 |
| 3810 | Dockermon Nest HTTP Api http://localhost:3810 |
| 3811 | Dockermon Nest Websocket Api ws://localhost:3811 |
| 3801 | Optional Dockermon Host Launcher Port Run by this source code, not the container ws://localhost:3801 |
Let's get the Dockermon container running. Assuming Docker is running, you have the code and are inside the dockermon directory, we are ready to party.
From Terminal, run:
docker-compose -p "dockermon" -f docker-compose.yml up --detach
That didn't work? Docker must be running to create the dockermon container.
Now Dockermon should be launched and you can see it running in docker. Once the container launches it will install node_modules for the frontend and backend separately. This is going to take a few minutes and only runs the first time. The MySQL database will also initialize, create the tables, and the backend and workers will launch. Everything will fire up, but it will take a few minutes the first time. After that, bootups will be a matter of a few seconds.
Be patient. Give Dockermon a good 5 minutes to build, start up and start collecting stats.
The good news is all of the node_modules and database directories are stored in Docker volumes, so if you reinstall or recreate the container, it can pick up the existing volume and resume where you left off unless you delete the Docker volumes or prune ununsed.
Once you see the backend colorfully logging, you can access the web interface at http://localhost:3800
The initial login details are as follows:
| Login | Credentials |
|---|---|
| username | [email protected] |
| password | dockermon |
What is this? - Dockermon Host Launcher - Mac OS is a utility Nest JS web socket server app that runs on your host machine for the web interface to mimic Docker Desktop launch Terminal, Finder and docker commands and etc. This only works on the local machine and exposes port 3801 by default. If you are remote monitoring a Docker instance you will not be able to launch terminals, open folders, etc.
Windows implementation of this host launcher will be available in future releases.
This code is Open Source and available in this repo for your sanity. Or read here.
To run the code in the git clone earlier, inside the dockermon diretory, run:
npm install
npm run build
npm start
Tip add an & at the end of npm run start: npm run start & if you wish to run the host launcher in the background. If you wish to watch the output of the Host Launcher, run npm run start instead.
You should now see docker host launcher running on port 3801. You can change this port but it is not recommended.
.env file
DOCKERMON_LOGGING="json-file"
DOCKERMON_BACKEND_WS_PORT=3811
DOCKERMON_BACKEND_API_PORT=3810
DOCKERMON_FRONTEND_PORT=3800
DOCKERMON_HOST_LAUNCHER_PORT=3801
DOCKERMON_WORKER_HTTP_PORT=3820
DOCKERMON_WORKER_HOST_ADDRESS="localhost"
DOCKERMON_ENABLE_GIT_UPDATE=1
DOCKERMON_ENABLE_GIT_BRANCH="main"
DOCKERMON_ENABLE_SOCAT=1
DOCKERMON_DOCKER_LOCAL_SOCKET="/var/run/docker.sock"
DOCKERMON_CURRENT_ENV="prod"
REDIS_PORT=6379
REDIS_HOST="localhost"
MYSQL_DOCKER_PORT=3306
MYSQL_DOCKER_PORT=3306
MYSQL_LOCAL_PORT=3306
MYSQL_DEV_PORT=3306
MYSQL_DEV_USER="root"
MYSQL_DEV_DB="dockermon"
MYSQL_DEV_PW="dockermon"
MYSQL_DEV_HOST="localhost"
docker-compose.yml
version: '3.8'
services:
dockermon:
container_name: dockermon
image: webfreakeric/dockermon:latest
command: /bin/bash /app/dockermon-app/start.sh
restart: always
env_file: ./.env
deploy:
labels:
com.docker.compose.project: 'dockermon'
environment:
DOCKERMON_BACKEND_WS_PORT: $DOCKERMON_BACKEND_WS_PORT
DOCKERMON_BACKEND_API_PORT: $DOCKERMON_BACKEND_API_PORT
DOCKERMON_FRONTEND_PORT: $DOCKERMON_FRONTEND_PORT
DOCKERMON_WORKER_HOST_ADDRESS: $DOCKERMON_WORKER_HOST_ADDRESS
DOCKERMON_HOST_LAUNCHER_PORT: $DOCKERMON_HOST_LAUNCHER_PORT
DOCKERMON_ENABLE_GIT_UPDATE: $DOCKERMON_ENABLE_GIT_UPDATE
DOCKERMON_ENABLE_GIT_BRANCH: $DOCKERMON_ENABLE_GIT_BRANCH
MYSQL_ROOT_PASSWORD: $MYSQL_DEV_PW
MYSQL_DATABASE: $MYSQL_DEV_DB
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
TZ: America/New_York
ports:
- $DOCKERMON_FRONTEND_PORT:3800
- $DOCKERMON_BACKEND_API_PORT:$DOCKERMON_BACKEND_API_PORT
- $DOCKERMON_BACKEND_WS_PORT:$DOCKERMON_BACKEND_WS_PORT
- $DOCKERMON_DOCKER_LOCAL_SOCKET:/var/run/docker.sock
volumes:
# - dockermon_db-config:/etc/mysql
- dockermon_db-data:/var/lib/mysql
- dockermon_node_modules_fe:/app/dockermon-app/frontend/node_modules
- dockermon_node_modules_be:/app/dockermon-app/backend/node_modules
# - ./db/backup/files/:/data_backup/data
logging:
driver: $DOCKERMON_LOGGING
cap_add:
- SYS_NICE # CAP_SYS_NICE
volumes:
dockermon_db-data:
dockermon_node_modules_fe:
dockermon_node_modules_be:
This is not meant for production environments although you can connect to any Docker host that has the Engine API ports exposed. This is in the early development stages. In other words, use at your own risk, do not use it in production!!
Enjoy!
Backend built with: Nest, Node.js, TypOrm, Nest Bull, SocketIO
Frontend built with: React, Next.js, PrimeReact, Redux, SocketIO
Content type
Image
Digest
Size
255.4 MB
Last updated
over 4 years ago
docker pull webfreakeric/dockermon