Tuesday, May 31, 2016

Unix utilities

Rename all files which contain rc to deployment

ls * | sed -e 'p;s/rc/deployment/' | xargs -n2 mv

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