Maintain Docker Images


List images

docker images
docker images -a

Grab an image from Docker Hub

docker pull pbraun9/ubuntu

Get rid of the orphaned ones

docker rmi IMAGE-ID

Edit an image w/o rebuilding it

You need to get into an instance and then make the changes by converting it back into an image

docker exec -ti $instance /bin/bash

do your thing and take the chance to update the freaking image e.g.

apt update
apt -y full-upgrade
apt -y autoremove --purge

ideally shut-down the instance clean

docker stop $instance

generate an image – possibly against the very same name

docker commit $instance IMAGE-NAME

then you can get rid of it

docker rm $instance --force
# --force (in case it was commited live)

Wipe-out all images

docker rmi `docker images --quiet` --force
#docker images --quiet | xargs docker rmi --force
docker images
docker images -a

Additional notes

eventually change the entrypoint on the way

docker run -ti --entrypoint SOMETHING-ELSE ...
docker commit ...


docker commit

docker container commit

How to edit docker image in two ways

Change Docker image file system

How to Commit Changes to a Docker Image with Examples

tuning an image

Docker Commit Created Images and ENTRYPOINT

How to Override Entrypoint Using Docker Run