This article lists useful Docker commands and tasks for those who use ZeroNorth Platform’s Integration-Orchestrator Docker image for on-prem scans.
Note: in some environments, it will be necessary to run docker commands as root or via sudo.
Basic Docker Commands
-
docker ps
- to list the currently active containers. -
docker ps -a
- to list all containers. -
docker stop <container ID>
- to gracefully stop a running container. -
docker logs [-f] <container ID>
- to view the log messages of a container. Using “-f” will follow the logs if the container is still running. -
docker images
- to list all images. -
docker login
- to authenticate with Docker Hub. This step is necessary if you will be working with Docker Images that require authenticate/access to pull.
Common Clean-up Tasks
- Cleaning up Exited ZeroNorth Docker containers :
docker container ls -a 2>/dev/null | grep 'zeronorth' | grep -w 'Exited' | cut -d' ' -f1 | xargs docker container rm -f
While you can always use docker container prune
, the above command example ensures that you only clean up the ZeroNorth-related containers.
-
Cleaning up stale images - sometimes, a docker image becomes stale/orphaned. This is indicated by a tag of “”. To clean these up:
- List the stale images:
docker image ls -a | grep '<none>'
2. From the output of the above, for each of the image ID:
docker image rm -f <image ID>
Convenience Scripts
The following scripts are provided (download links below) for managing the ZeroNorth Docker container images:
- zn_docker_clean.bash - performs the two clean up tasks described above.
- zn_docker_refresh.bash - refreshes all local copies of zeronorth Docker images.