Container logs are deleted when the container is removed Containers can be referenced by Id (Partial) or Name (Full)
Docker Auto Start
In the Run command include the following command to ensure that the containers restart automatically if the server ever reboots.
Centos does not automatically start the docker daemon once installed, to do this enter the following commands to ensure that the docker daemon will start automatically if the server ever reboots.
systemctl start docker
systemctl enable docker
docker <Action> <Container Id>
- stop - Stops a running container
- start - Starts a stopped container
- restart - Restarts a running container
- rm - Removes a stopped container.
- logs - Show logs of a container where applicable
- ps - Show list of containers.
- exec - Execute a command against a container
- stats - Show statistics related to the host or containers.
Show Running Containers
Show All Containers
docker ps - a
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
docker logs <Container Id>
View Logs Last 50 Entries
docker logs <Container Id> --tail 50
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
- --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
Entering the container should be done with caution as all commands are immediate and can adversely affect the functionality.
docker exec -it <Container Id> <Command>
Check Mail Queue
docker exec -it <Container Id> mailq
Enter Bash in Container
docker exec -it <Container Id> /bin/bash
Monitor Container Utilization
This will show the utilization of each container on the host.
docker stats <Container Id>