Untag and remove images

Modified: 09 Nov 2022 00:15 UTC

Image maintenance is essential. It's easy for the number of Docker images to pile up as you deploy new containers and update old applications, leading to a tremendous use of disk space. There is no automatic cleaning mechanism, so it's up to every individual to manually remove and maintain their image list.

See all examples in the official Docker documentation.

Removing images

NOTE: Before removing a Docker image, it's important that no container is running that uses the image in question. Otherwise, you will not be able to remove the image.

To remove a Docker image, use triton-docker rmi along with either the image name or UUID. For example, I'll list the available images below and remove heyawhite/hello-nginx which is no longer in use.

$ triton-docker images
REPOSITORY                         TAG                 IMAGE ID            CREATED             SIZE
autopilotpattern/consul            latest              ef47b6eace64        4 months ago        16.21 MB
autopilotpattern/consul            0.7.2-r0.8          ee5fb720912b        9 months ago        0 B
heyawhite/hello-nginx              latest              e658a0aba305        7 months ago        0 B
php                                5.6-apache          8f9106ac157a        9 months ago        0 B

$ triton-docker rmi heyawhite/hello-nginx
Untagged: heyawhite/hello-nginx:latest
Deleted: e658a0aba305d2de72c38eb71bda1faf777b08e4714dfd27b15c26cc2e051240
Deleted: 5b425b432417d4b0be2f917651ead4c9f287bce24075262e7764da59ebe8af84
Deleted: abc32116644227c10ff057c684860b62b806c6f958c16a95d69dc88f95e5f0a3
Deleted: 2963d1bbd6bd306d3cc261352c8cfce78f5cc0618048eb3f1d2dd1296df39079
Deleted: dd2137d797118c39d7420a65ed99e320a7d3d6db885a4df263ea410fc578df7d
Deleted: d9be8e2e1d684782e15edaefba04b8df2e4d6ae8cd410b842429108279b40b4d
Deleted: 8dacaa3090b88e299c7efe200fd4ef138c5c003fdbe0e3faaa8b882e0ed2b9d5
Deleted: 6f8e5cd1315fb9330934fe857cccffdb9dca3cc2f411eea46899700d857cfa23
Deleted: 425e28bb756f57de4877c664afc945b8f0a0458c33f74a6d14860baaf97c02fd
Deleted: 4d4b5520c444639e9c347fc62037ff0efe7a14d9af9ce39f4b71d4e6f2b55a4f
Deleted: cfae62ad9233cb1aad3cf290e75d493dd57ab56d29c0f228600a77ad825ee0a1
Deleted: 4d43e3e8873c566e79ea6789c568f0c74ee0b4150117f337157f40624b9f51a0

Untagging images

It's possible you have more than one image with the same name. For example, I have two versions of autopilotpattern/consul with different tags. If I try to remove the image with the name, it will fail.

Instead, use the UUID of the specific version you wish to remove with triton-docker rmi:

$ triton-docker rmi ef47b6eace64
Untagged: autopilotpattern/consul:latest
Deleted: sha256:ef47b6eace64380ed9b2f18dbeb7ab5596d5a3e0d26c98086b0d452842edac00

Using the portal to manage Docker images

At this time, it is not possible to use the Triton portal to delete Docker images. However, you can view a list of all of your images across the Triton data centers on the Docker Images page.