Docker tips

Setting tag on an image

Bash
sudo docker tag 5db5f8471261 rhrn/ubuntu:webdev

Get bash inside runned container

Bash
sudo docker exec -i -t 665b4a1e17b6 bash

Clear docker unused images

Bash
docker rmi $(docker images -f "dangling=true" -q)

Clear docker exited containers

Bash
docker rm $(docker ps -aq -f status=exited)

Clear unused volumes

Bash
docker volume ls -qf dangling=true | xargs -r docker volume rm

Sort images by size

Bash
docker images --format "{{.ID}}\\t{{.Size}}\\t{{.Repository}}" | sort -k 2 -h
0 Shares:
Leave a Reply

Your email address will not be published. Required fields are marked *

You May Also Like