Handy Tricks for Docker
Builds based of current directory
With a name & tag
docker build -t <name>:<tag> .
# Eg
docker build -t awesomeimage:1.0 .
|
docker image ls
# OR
docker ima
|
First retrieve the image ID using the ls command.
If the image is used by multiple containers & you’re sure you want to delete it, you can run:
To delete all unused & “dangling” images
#lists all images that are dangling and has no pointer to it
docker images --filter dangling=true
#Removes all those images.
docker rmi -f `docker images --filter dangling=true -q`
|
To explore the built environment
docker run -it <image name> sh
|
First get the container ID using the ps command
docker kill <container ID>
|