<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	>

<channel>
	<title>Docker &#8211; Jiří Kratochvíl</title>
	<atom:link href="https://jiri.kratochvil.eu/tag/docker/feed/" rel="self" type="application/rss+xml" />
	<link>https://jiri.kratochvil.eu</link>
	<description>Kráťovo občasník</description>
	<lastBuildDate>Thu, 18 Dec 2014 14:24:03 +0000</lastBuildDate>
	<language>cs</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7</generator>

<image>
	<url>https://jiri.kratochvil.eu/wp-content/uploads/2018/10/kratochvil-logo-100x100.png</url>
	<title>Docker &#8211; Jiří Kratochvíl</title>
	<link>https://jiri.kratochvil.eu</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">10187198</site>	<item>
		<title>How to keep clean your Docker?</title>
		<link>https://jiri.kratochvil.eu/how-to-keep-clean-your-docker/</link>
					<comments>https://jiri.kratochvil.eu/how-to-keep-clean-your-docker/#respond</comments>
		
		<dc:creator><![CDATA[Jiří Kratochvíl]]></dc:creator>
		<pubDate>Thu, 18 Dec 2014 14:24:03 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Návody]]></category>
		<category><![CDATA[Docker]]></category>
		<category><![CDATA[Tipy]]></category>
		<guid isPermaLink="false">http://jiri.kratochvil.eu/?p=469</guid>

					<description><![CDATA[I&#8217;ve been playing around with Docker, perfect platform for developers and sysadmins to build, ship, and run distributed applications. It is cool &#8211; there is [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>I&#8217;ve been playing around with <a href="https://www.docker.com/">Docker</a>, perfect platform for developers and sysadmins to build, ship, and run distributed applications. It is cool &#8211; there is lot of possibilities how to use it to get my things done.</p>
<p>After playing with Docker, I&#8217;ve realized that my disk is running out of all my hard drive space so I started to investigate where my gigabytes went. Docker uses for running containers lot of images which could have about 1 gigabyte. And I had there a <strong>lot of images</strong> and most of them were stopped, untagged and useless.</p>
<p><span id="more-472"></span></p>
<p>But removing then manually takes some time and it is boring. Additionally Docker does not have any built-in commands for cleaning stopped containers and untagged images, so I put together some of command to do it my way.</p>
<div>
<h2><b>Remove all untagged images </b></h2>
</div>
<div>I had bunch of images that were not tagged. You can remove <strong>all untagged images</strong> using this command:</div>
<pre lang="bash">docker images | grep "^&lt;none&gt;" | awk -F$' ' '{print $3}'
</pre>
<div>This works by using rmi (docker command deleting docker image) with a list of image ids. To get the image ids we call <code>docker images</code> then pipe it to <code>grep "^&lt;none&gt;"</code>. The grep will filter it down to only lines with the value ”&lt;none&gt;” in the repository column. Then to extract the id out of the third column we pipe it to <code>awk '{print $3}'</code> which will print the third column of each line passed to it.</div>
<div>
<h2>Remove all stopped containers</h2>
<p>To do it, you can simply execute this command:</p>
<pre lang="bash">docker rm $(docker ps -a -q)
</pre>
<p>This will remove all stopped containers by getting a list of all containers with <code>docker ps -a -q</code> and passing their ids to docker rm. This <strong>should not remove any running containers</strong>, and it will tell you it can’t remove a running image.</p>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://jiri.kratochvil.eu/how-to-keep-clean-your-docker/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">472</post-id>	</item>
	</channel>
</rss>
