List all the tags for a image on docker hub

2020-03-16 1 min read Learning Vurtualization
Something that you may want to know sometimes and docker cli does not show by default is all the tags for the image on docker hub. Here is example to list all tags fro the centos image curl https://registry.hub.docker.com/v2/repositories/library/centos/tags |jq '."results"[]["name"]' The example is for a v2 registry. The output for v1 is different than v2 registry. For a v1 registry, you can use command like below curl https://registry.hub.docker.com/v1/repositories/centos/tags |jq '. Continue reading

Get disk usage for all the containers with python script

2017-01-16 1 min read Python
With my increasing love for python, here is my attempt to get the disk usage of all the containers on some host. Well, since the requirements vary for everyone, so this script is far from complete. import docker import json # We will connect to 192.168.122.1 for docker daemon. If that is not the case, # then change the below. client = docker.DockerClient(base_url="tcp://192.168.122.1:4243") # Get list of all containers. cls=client.containers.list() stats={} # And now we will iterate over that list to get stats for all the containers. Continue reading

ansible with docker dynamic inventory

2017-01-09 2 min read bash Fedora Vurtualization
So, I have a few dockers. Every now and then I want to run some command on all of them. Doing ‘docker exec’ is tiresome. I found this neat solution with ansible that I thought I should share with you. To get started, you need to have the “docker.py” script. This script will be used as python script inventory for ansible. So, use the following command and get the script: Continue reading

apache in docker to serve local website

2015-01-05 2 min read Fedora Vurtualization
I have some backup’s of website on my laptop, which I occasionally want to view. Now, I could have setup apache to serve them directly with VirtualHost or alias but wanted a better solution. So, docker comes to rescue. First, I installed fedora-dockerfiles and then made some modifications, here they are : sudo yum install fedora-dockerfiles After this is done, go to /usr/share/fedora-dockerfiles/apache and make some modification to Dockerfile. After the modifications, the file looks like this Continue reading