Docker
Also See:
Docker Basic Commands
List All of the Containers:
docker container ls -a
Run Named instance as a daemon
docker container run -d --name <containername> <imagename>
Remove a Container
docker container rm <containername>
Publish a port (specify external port):
docker container run -d --name <containername> -p <externalport>:<internalport> <imagename>
Publish a port (dynamically exposed port):
docker container run -d --name <containername> -p <internalport> <imagename>
Publish a Volume with Local Storage:
docker container run -d -v <localpath>:<containerpath> <imagename>
Running Docker
Run a process that will complete at the end:
docker container run --rm <imagename>
Backup
To get a list of all running Items:
docker ps
Create a backup of the image:
docker commit -p <hash> <imagename>
List all of the images:
docker images
Export the image:
docker save -o ~/container1.tar <imagename>
Restore
Load the Image:
docker load -i /root/container1.tar
Administration
Access the bash prompt:
docker exec -i -t <containername> /bin/bash
Get the Logs:
docker container logs <containername>
Build Docker Images
Building a container and giving it a name
docker image buid -t <imagename> .
Tagging a Docker Image
Get a list of the disk images to get the image id:
`docker image ls
Tag the disk image for deployment:
docker tag <image_id> <tag_name>
Docker SBOM
You can generate a SBOM with the following tools