About
This article will help with Docker management for the On-Premise Gateway and Virtru Private Keystore (for Virtru Solutions) products.
Jump To
- List Containers
- Control Containers
- Logs
- Enter Container
- Monitor Container Utilization
- Load Offline Image
- Export Image
- Remove All Containers
- Tools
Items to Note
- Container logs can be deleted when the container is removed.
- Containers can be referenced by Id (Partial) or Name (Full)
List Containers
Show Running Containers
docker ps
Show All Containers
docker ps - a
Control Container
docker <Action> <Container Id>
Actions
- stop - Stops a running container
- start - Starts a stopped container
- restart - Restarts a running container
- rm - Removes a stopped container. Deleting all associated logs and files.
Logs
All logs for the Virtru Gateway are written to the stdout and are thus saved to the docker host via standard logging. All logs can be redirected using standard docker utilities. Please reference Docker Log Managment and Configuration
Default log location on host server
var/lib/docker/containers/<containerID>/<containerID>-json.log
View Logs
docker logs <Container Id>
View Logs Last 50 Entries
docker logs <Container Id> --tail 50
Follow Logs
docker logs <Container Id> -f
Follow Logs Starting from 30 minutes ago
docker logs <Container Id> -f --since 30m
Follow Logs Starting from Last 50 Entries
docker logs <Container Id> -f --tail 50
Options
- --tail # - Last # of entries
- -f - Follow the logs - Ctrl + C to exit
- --since - Show logs since timestamp (e.g. 2013-01-02T13:23:37) or relative (e.g. 42m for 42 minutes)
- --until - Show logs through timestamp (e.g. 2013-01-02T13:23:37) or relative (e.g. 42m for 42 minutes)
- --details - Show extra details provided to logs
Enter Container
Entering the container should be done with caution as all commands are immediate and can adversely affect the functionality.
Enter Bash in Container
docker exec -it <Container Id> /bin/bash
Run Command in Container
docker exec -it <Container Id> <Command>
Monitor Container Utilization
This will show the utilization of each container on the host.
Statistics
docker stats
Container Statistics
docker stats <Container Id>
Host Storage Management
Release unused storage.
docker container prune
docker image prune -a
Load Offline Image
Load an image from a tar archive.
docker load --input /path/to/image/image.tar
docker load -i /path/to/image/image.tar
Export Image
Save an image to a tar archive.
docker save --output virtru-gateway-v2.2.18.tar virtru/gateway:2.2.18
docker save -o virtru-gateway-v2.2.18.tar virtru/gateway:2.2.18
Remove All Stopped Containers
Removes all stopped containers. The rm command will not run against running containers.
docker rm $(docker ps -aq)
Tools
Tools available for download.
Check Endpoint Accessibility from the host: Link
Usage
sh checkendpoints.sh
Run a command against all containers: Link
Usage
sh runall.sh mailq
Send a test message: Link
Usage
sh sendtestmessage.sh