Maintain Docker Images

Operations

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
^D

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 ...

Resources

docker commit https://docs.docker.com/engine/reference/commandline/commit/

docker container commit https://docs.docker.com/engine/reference/commandline/container_commit/

How to edit docker image in two ways https://bobcares.com/blog/edit-docker-image/

Change Docker image file system https://stackoverflow.com/questions/56772106/change-docker-image-file-system

How to Commit Changes to a Docker Image with Examples https://phoenixnap.com/kb/how-to-commit-changes-to-docker-image

tuning an image

Docker Commit Created Images and ENTRYPOINT https://stackoverflow.com/questions/29015023/docker-commit-created-images-and-entrypoint

How to Override Entrypoint Using Docker Run https://phoenixnap.com/kb/docker-run-override-entrypoint


HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5 | CONTACT
Copyright © 2024 Pierre-Philipp Braun