Monday, December 14, 2015

Deleting docker images based on condition or filter

I posted about deleting docker containers and deleting images.Sometimes we need to clean only some images based on a condition.

I am adding to commands to delete untagged images.You can grep on any value you like.

#Deleting untagged images
docker rmi $(docker images | grep none | awk '{print $3}')

Saturday, December 12, 2015

Difference between role and cookbook in chef

A role may be made up of one of more cookbooks whereas cookbook is a single entity made up of recipes.

So roles can be used to simplify run lists.
Instead of providing a run list with all the cookbooks a role can be provided.

{
 run_list : [
    "role[test]"
 ]
}

can be used instead of
{
 run_list : [
    "recipe[test1]",
    "recipe[test2]",
    "recipe[test3]"
 ]
}

Difference between ADD and COPY in docker

The commands for deleting the containers and images are
The major difference is that ADD can do more than COPY:
  • ADD allows the source to be an URL
  • Also If the  parameter of ADD is an archive in a recognised compression format, it will be unpacked

Friday, December 11, 2015

Remove docker images and containers

When we use docker we end up running a lot of containers and creating a lot of images

The commands for deleting the containers and images are

#docker stop all containers
docker stop $(docker ps -a -q)

#docker remove all containers
docker rm $(docker ps -a -q)

#docker remove all images
docker rmi $(docker images -q)