This is just an experiment, an implementation of a web UI using the docker CLI: UI => API => Docker CLI => Docker API
It works, but it is neither maintainable nor very reliable, so do not use it in a production env.
A more solid approach would skip the CLI and use the API directly:
Docker API
Docker API Example
NodeJs unix socket example
If you need a "prod ready" app for this, there are plenty (some open source) solutions out there, just search for "docker web UI" or similar.
- Docker Engine for Linux / Docker Desktop with WSL integration
- Node.js LTS [only for development]
- local folders
node run build
- in Docker
node run build-docker
node run scan
Security warning: Docker daemon has root access, so do NOT expose this outside 127.0.0.1
!!!
Info generate self-signed certs with openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -out cert.crt -keyout cert.key
- local folders
export CERT_CRT="/run/secrets/cert.crt" # optional
export CERT_KEY="/run/secrets/cert.key" # optional
export DEBUG="*" # optional
node run start
- local image
node run start-docker
- public image
docker stop dockman && docker rm dockman || echo "not running
docker run --name dockman --pull always --restart=always -d \
-v "/var/run/docker.sock:/var/run/docker.sock" \
-v "/var/lib/docker/volumes:/var/lib/docker/volumes" \
-v "${HOME}/certs/cert.crt:/run/secrets/cert.crt" `# optional` \
-v "${HOME}/certs/cert.key:/run/secrets/cert.key" `# optional` \
-p "127.0.0.1:55555:55557" \
vallyian/dockman:latest
If running Docker Desktop with WSL integration, app won't be able to access volumes (except names) Could still make Docker volume dir accessible in current WSL distro
mkdir -p /var/lib/docker/volumes
mount -t drvfs '\\wsl$\docker-desktop-data\version-pack-data\community\docker\volumes' /var/lib/docker/volumes