<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Docker on Amit Agarwal Linux Blog</title>
    <link>/tags/docker/</link>
    <description>Recent content in Docker on Amit Agarwal Linux Blog</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Sat, 08 Feb 2025 00:00:00 +0530</lastBuildDate>
    
	<atom:link href="/tags/docker/index.xml" rel="self" type="application/rss+xml" />
    
    
    <item>
      <title>Using Burp with Containers In Docker</title>
      <link>/2025/02/08/2025-02-08-UsingBurpwithContainersInDocker/</link>
      <pubDate>Sat, 08 Feb 2025 00:00:00 +0530</pubDate>
      
      <guid>/2025/02/08/2025-02-08-UsingBurpwithContainersInDocker/</guid>
      <description>&lt;h1 id=&#34;making-docker-containers-trust-burp-suites-ca-for-testing&#34;&gt;Making Docker Containers Trust Burp Suite&amp;rsquo;s CA for Testing&lt;/h1&gt;
&lt;p&gt;When testing applications running inside Docker containers, intercepting traffic with Burp Suite can be challenging because containers don’t automatically trust Burp’s CA certificate. Without trust, HTTPS requests from inside the container will fail with certificate errors.&lt;/p&gt;
&lt;p&gt;In this post, I’ll show you how to:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Add Burp Suite’s CA to your host system&lt;/li&gt;
&lt;li&gt;Pass the trusted CA to Docker containers&lt;/li&gt;
&lt;li&gt;Ensure seamless HTTPS traffic interception for testing&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Let’s get started!&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Run X11 applications on docker or podman</title>
      <link>/2024/03/30/2024-03-30-x11docker/</link>
      <pubDate>Fri, 29 Mar 2024 00:00:00 +0530</pubDate>
      
      <guid>/2024/03/30/2024-03-30-x11docker/</guid>
      <description>&lt;p&gt;Found &lt;a href=&#34;https://github.com/mviereck/x11docker&#34;&gt;x11docker&lt;/a&gt; project in github. This is
a very nice project if you are trying to run GUI applications in dockers. It takes the
hassle out and helps you run the GUI applications very easily in docker.&lt;/p&gt;
&lt;p&gt;Whats more, if you are on Fedora, you are in luck. You can install this tool with&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo dnf install x11docker
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;and if you are not on Fedora, then head over to their github.
Some other distributions also have it packaged but otherwise also it
is very simple to install.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>List all the tags for a image on docker hub</title>
      <link>/2020/03/16/list-tags-image-docker-hub/</link>
      <pubDate>Mon, 16 Mar 2020 00:58:19 +0000</pubDate>
      
      <guid>/2020/03/16/list-tags-image-docker-hub/</guid>
      <description>&lt;p&gt;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&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;pre class=&#34;brush:shell&#34;&gt;curl https://registry.hub.docker.com/v2/repositories/library/centos/tags |jq &#39;.&#34;results&#34;[][&#34;name&#34;]&#39;&lt;/pre&gt;
&lt;p&gt;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&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;pre class=&#34;brush:shell&#34;&gt;curl https://registry.hub.docker.com/v1/repositories/centos/tags |jq &#39;.[][&#34;name&#34;]&#39;&lt;/pre&gt;</description>
    </item>
    
    <item>
      <title>Get disk usage for all the containers with python script</title>
      <link>/2017/01/16/disk-usage-containers-python-script/</link>
      <pubDate>Mon, 16 Jan 2017 01:05:29 +0000</pubDate>
      
      <guid>/2017/01/16/disk-usage-containers-python-script/</guid>
      <description>&lt;p&gt;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.&lt;/p&gt;
&lt;pre class=&#34;brush:py&#34;&gt;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=&#34;tcp://192.168.122.1:4243&#34;)

# 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.
for val in cls:
    print (val.name)
    stats[val.name] = val.stats(stream=False)
    # Get the disk usage for root and /tmp from containers with docker.exec
    stats[val.name][&#39;df-root&#39;] = ( str(val.exec_run(r&#39;df -kh --output=&#34;size,used,avail,pcent&#34; /&#39;, stream=False).splitlines()[1]).replace(&#34;&#39;&#34;,&#34;&#34;).split()[1:] )
    stats[val.name][&#39;df-tmp&#39;] = ( str((val.exec_run(r&#39;df -kh --output=&#34;size,used,avail,pcent&#34; /tmp &#39;, stream=False).splitlines()[1:]+[&#39;&#39;])[0]).replace(&#34;&#39;&#34;,&#34;&#34;).split()[1:] )

# Now if you want, we have dict of all the data and we can process the
# way we like it, for example create a html table for disk usage only.
print (&#39;&amp;lt;table&amp;gt;&#39;)
for st in stats:
    print (&#39;&amp;lt;tr&amp;gt;&#39;)
    print (&#34;&amp;lt;td&amp;gt;Root-%s&amp;lt;/td&amp;gt;&#34;%(st))
    for i in stats[st][&#39;df-root&#39;]:
        print (&#39;&amp;lt;td&amp;gt;%s&amp;lt;/td&amp;gt;&#39;%(i) )
    print (&#39;&amp;lt;/tr&amp;gt;&#39;)
    print (&#39;&amp;lt;tr&amp;gt;&#39;)
    print (&#34;&amp;lt;td&amp;gt;tmp-%s&amp;lt;/td&amp;gt;&#34;%(st))
    for i in stats[st][&#39;df-tmp&#39;]:
        print (&#39;&amp;lt;td&amp;gt;%s&amp;lt;/td&amp;gt;&#39;%(i) )
    print (&#39;&amp;lt;/tr&amp;gt;&#39;)

print (&#39;&amp;lt;/table&amp;gt;&#39;)
&lt;/pre&gt;</description>
    </item>
    
    <item>
      <title>ansible with docker dynamic inventory</title>
      <link>/2017/01/09/ansible-docker-dynamic-inventory/</link>
      <pubDate>Mon, 09 Jan 2017 00:50:55 +0000</pubDate>
      
      <guid>/2017/01/09/ansible-docker-dynamic-inventory/</guid>
      <description>&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;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:&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>docker search description truncated</title>
      <link>/2015/05/05/docker-search-description-truncated/</link>
      <pubDate>Tue, 05 May 2015 00:55:32 +0000</pubDate>
      
      <guid>/2015/05/05/docker-search-description-truncated/</guid>
      <description>&lt;p&gt;When you search with “docker search”, you would notice that the description of the image is truncated. Sometimes you want to see full description, to do so, you can use &lt;strong&gt;–no-trunc&lt;/strong&gt; option. So, for example you want to search for fedora images, you can use the following command:&lt;/p&gt;
&lt;pre class=&#34;brush:shell&#34;&gt;docker search --no-trunc  fedora&lt;/pre&gt;</description>
    </item>
    
    <item>
      <title>apache in docker to serve local website</title>
      <link>/2015/01/05/apache-docker-serve-local-website/</link>
      <pubDate>Mon, 05 Jan 2015 01:15:44 +0000</pubDate>
      
      <guid>/2015/01/05/apache-docker-serve-local-website/</guid>
      <description>&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;First, I installed fedora-dockerfiles and then made some modifications, here they are :&lt;/p&gt;
&lt;pre class=&#34;brush:shell&#34;&gt;sudo yum install fedora-dockerfiles&lt;/pre&gt;
&lt;p&gt;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&lt;/p&gt;</description>
    </item>
    
  </channel>
</rss>
