{"id":3413,"date":"2018-02-01T17:15:00","date_gmt":"2018-02-01T15:15:00","guid":{"rendered":"https:\/\/www.systemcodegeeks.com\/?p=3413"},"modified":"2018-02-01T10:32:40","modified_gmt":"2018-02-01T08:32:40","slug":"easy-container-cleanup-cron-docker-environments","status":"publish","type":"post","link":"https:\/\/www.systemcodegeeks.com\/devops\/easy-container-cleanup-cron-docker-environments\/","title":{"rendered":"Easy Container Cleanup in Cron + Docker Environments"},"content":{"rendered":"<p>By nature, Docker containers are temporary. Yet as anyone who runs containers via <a href=\"https:\/\/en.wikipedia.org\/wiki\/Cron\">Cron<\/a> can tell you, it\u2019s not always so great at cleaning up after itself. In today\u2019s article, we are going to explore two flags that make it easier to run Dockerized Cron jobs.<\/p>\n<p>Before we get too far into this article, let\u2019s explore how we would traditionally create and clean up a Docker container.<\/p>\n<h2>Creating a Simple Hello World Container<\/h2>\n<p>For this article, we will use the official \u201cHello World\u201d Docker container. Let\u2019s jump right in by downloading this container and running it with the <code>docker run<\/code> command.<\/p>\n<pre class=\"brush:php\">$ docker run hello-world  \r\nUnable to find image 'hello-world:latest' locally  \r\nlatest: Pulling from library\/hello-world  \r\nca4f61b1923c: Pull complete  \r\nDigest: sha256:445b2fe9afea8b4aa0b2f27fe49dd6ad130dfe7a8fd0832be5de99625dad47cd  \r\nStatus: Downloaded newer image for hello-world:latest  \r\n\r\nHello from Docker!<\/pre>\n<p>This container is simple \u2014 it prints a hello message from Docker and quickly exists. In theory, this container was \u201ctemporary.\u201d If we run the <code>docker ps<\/code> command, it no longer appears.<\/p>\n<pre class=\"brush:php\">$ docker ps  \r\nCONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES<\/pre>\n<p>The above shows no running containers. But what happens if we add the <code>-a<\/code> flag?<\/p>\n<pre class=\"brush:php\">$ docker ps -a  \r\nCONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                     PORTS               NAMES  \r\ncc7edd5e71f8        hello-world         \"\/hello\"            3 minutes ago       Exited (0) 3 minutes ago                       sad_goldberg<\/pre>\n<p>The above <code>docker ps -a<\/code> output shows that we still have a <code>hello-world<\/code> container.<\/p>\n<p>Why didn\u2019t we see this in our first example? By default, the <code>docker ps<\/code> command only shows running containers. The <code>-a<\/code> flag tells the <code>docker ps<\/code> command to list all containers regardless of status.<\/p>\n<p>So what does this tell us? It tells us that while the <code>hello-world<\/code> container was running temporarily, the container itself is not actually temporary. It still exists even though it is not running.<\/p>\n<p>In fact, we can even restart that container using the <code>docker start<\/code> command.<\/p>\n<pre class=\"brush:php\">$ docker start -a sad_goldberg  \r\n\r\nHello from Docker!<\/pre>\n<p>So how would we clean up this container? We remove it of course.<\/p>\n<h2>Removing a Container<\/h2>\n<p>To remove our example container, we can execute the <code>docker rm<\/code> command.<\/p>\n<pre class=\"brush:php\">$ docker rm sad_goldberg  \r\nsad_goldberg\r\n\r\n$ docker ps -a  \r\nCONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES<\/pre>\n<p>We can see from the above that our container is gone, thus making it once again \u201ctemporary.\u201d<\/p>\n<h2>Why Does This Matter?<\/h2>\n<p>While the above information is useful, one might ask, \u201cWhy does this matter?\u201d If you recall the beginning of this article, I mentioned running Docker containers as Cron jobs. Some environments will use Cron to launch scheduled Docker containers.<\/p>\n<p>Using Docker with Cron gives users the benefits of Dockerizing an application while still using the application within a simple scheduled tasks environment.<\/p>\n<p>A common problem that occurs in those environments is <strong>too many containers<\/strong>. Let\u2019s take a look at a simple Cron + Docker example.<\/p>\n<pre class=\"brush:php\"># Run hello-world every minute\r\n\r\n* * * * * \/usr\/local\/bin\/docker run hello-world<\/pre>\n<p>The above Cron job will start a new <code>hello-world<\/code> container every minute. What\u2019s problematic is that it will create a <em>new container<\/em> every minute. This means after 100 minutes of saving this crontab, we will have 100 <code>hello-world<\/code> containers. This is a sure-fire way to create fun and interesting production issues.<\/p>\n<p>Like anything, Docker containers take up resources. Running containers will use memory, CPU, and disk space. Non-running containers take up resources as well. Specifically, non-running containers will use disk space.<\/p>\n<p>While our example container is fairly small, a real world container is likely to be much larger. Over time, creating new containers over and over again will start to use up the available disk space on the host.<\/p>\n<p>When all the disk space on a host is consumed, bad things happen.<\/p>\n<h2>How Do We Solve This?<\/h2>\n<p>There are a few ways to solve this issue. One is to leverage a container managment platform such as Kuberentes. However, in many cases even with things like <a href=\"https:\/\/github.com\/kubernetes\/minikube\">Minikube<\/a>, that might be a bit of overkill.<\/p>\n<p>Another simple solution, is to leverage the \u2013rm flag.<\/p>\n<h3>Using the \u2013rm flag<\/h3>\n<p>The <code>--rm<\/code> flag is an option passed on execution of the <code>docker run<\/code> command. This flag tells Docker to automatically remove the container after execution. To get a better understanding, let\u2019s go ahead and run another <code>hello-world<\/code> container, this time with the <code>--rm<\/code> flag specified.<\/p>\n<pre class=\"brush:php\">$ docker run --rm hello-world  \r\n\r\nHello from Docker!<\/pre>\n<p>The execution and output of the container didn\u2019t change, but let\u2019s look at <code>docker ps -a<\/code> once again.<\/p>\n<pre class=\"brush:php\">$ docker ps -a  \r\nCONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES<\/pre>\n<p>This time when we look at our container list, we see nothing. This shows exactly how the <code>--rm<\/code> flag can be useful. Useful, by removing the container once it\u2019s complete.<\/p>\n<p>Using this flag, we can solve our problem of creating too many containers. However, there is another common issue that many Cron + Docker environments run into: the same task running twice.<\/p>\n<p>In some cases, it doesn\u2019t matter if two copies of a Cron job are running at the same time. However, more often than not, Cron jobs are not generally designed to be executed more than once at a time. This can sometimes show itself as issues with resource utilization (<em>ie<\/em>, CPU or Memory usage). Or in cases such as Database maintenance, duplicate jobs create very troublesome issues.<\/p>\n<p>To solve this, we can combine the <code>--rm<\/code> flag with another flag.<\/p>\n<h3>Eliminating duplicates with the \u2013name flag<\/h3>\n<p>In a <a href=\"https:\/\/blog.codeship.com\/the-basics-of-the-docker-run-command\/\">previous article<\/a>, I mentioned using the <code>--name<\/code> flag to ensure only one instance of a container runs at a time. This is a very viable solution to our Cron example as well.<\/p>\n<p>Before exploring how this can solve our issue, let\u2019s take a second to get a refresher on how the <code>--name<\/code> flag works.<\/p>\n<pre class=\"brush:php\">$ docker run --name example hello-world     \r\n\r\nHello from Docker!<\/pre>\n<p>By adding the <code>--name<\/code> flag to our <code>docker run<\/code> command, we are giving our <code>hello-world<\/code> container a name. The name in our example was <code>example<\/code>. If we run a <code>docker ps<\/code> at the time of execution, we can see this name in use.<\/p>\n<pre class=\"brush:php\">CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                  PORTS               NAMES  \r\n7392326a5dc7        hello-world         \"\/hello\"            2 seconds ago       Up Less than a second                       example<\/pre>\n<p>What happens when the Docker run command is executed again?<\/p>\n<pre class=\"brush:php\">$ docker run --name example hello-world  \r\ndocker: Error response from daemon: Conflict. The container name \"\/example\" is already in use by container \"eb3c32c077aac8d7589eac90f62db22ef60d78c0abd46c48871923838818db52\". You have to remove (or rename) that container to be able to reuse that name.  \r\nSee 'docker run --help'.<\/pre>\n<p>When we execute the <code>docker run<\/code> command a second time, we receive an error stating our <code>example<\/code> name is in use. While this is a great way to solve duplicate containers running, any subsequent run of our crontab will result in the above error.<\/p>\n<p>However, if we combine the <code>--rm<\/code> flag with the <code>--name<\/code> flag, we get the best of both worlds.<\/p>\n<pre class=\"brush:php\">$ docker run --rm --name example hello-world  \r\n\r\nHello from Docker!<\/pre>\n<p>In the above example, our container was created with the <code>example<\/code> name just as before. However, when the container was finished executing, it was removed. We can see this again if we look at the following <code>docker ps<\/code> (running in a while loop).<\/p>\n<pre class=\"brush:php\">$ while  \r\nwhile&gt; do  \r\nwhile&gt; sleep 1  \r\nwhile&gt; docker ps -a  \r\nwhile&gt; done  \r\nCONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES  \r\n2e109d270d19        hello-world         \"\/hello\"            1 second ago        Created                                 example  \r\nCONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                  PORTS               NAMES  \r\n2e109d270d19        hello-world         \"\/hello\"            2 seconds ago       Up Less than a second                       example  \r\nCONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES<\/pre>\n<p>While the container was running, no other container could use the <code>example<\/code> name. However, since it was removed after execution, a new container can use that same name, solving our issue of duplicate jobs running at once.<\/p>\n<h2>Summary<\/h2>\n<p>In today\u2019s article, we first learned the basics of creating and removing a container. We also learned how Docker can be a bit messy and leave non-running containers around.<\/p>\n<p>Most importantly, what we showed today is that using both the <code>--rm<\/code> and the <code>--name<\/code> flags together can be powerful. This is especially true for those using Cron + Docker to create temporary containers \u2014 containers that need to exist while running but go away afterward.<\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td>Published on System Code Geeks with permission by Ben Cane, partner at our <a href=\"http:\/\/www.systemcodegeeks.com\/join-us\/scg\/\" target=\"_blank\" rel=\"noopener\">SCG program<\/a>. See the original article here: <a href=\"https:\/\/blog.codeship.com\/easy-container-cleanup-in-cron-docker-environments\/\" target=\"_blank\" rel=\"noopener\">Easy Container Cleanup in Cron + Docker Environments<\/a><\/p>\n<p>Opinions expressed by System Code Geeks contributors are their own.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>By nature, Docker containers are temporary. Yet as anyone who runs containers via Cron can tell you, it\u2019s not always so great at cleaning up after itself. In today\u2019s article, we are going to explore two flags that make it easier to run Dockerized Cron jobs. Before we get too far into this article, let\u2019s &hellip;<\/p>\n","protected":false},"author":36,"featured_media":390,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[39],"tags":[143,142,42],"class_list":["post-3413","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops","tag-container","tag-cron","tag-docker"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Easy Container Cleanup in Cron + Docker Environments - System Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"By nature, Docker containers are temporary. Yet as anyone who runs containers via Cron can tell you, it\u2019s not always so great at cleaning up after itself.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.systemcodegeeks.com\/devops\/easy-container-cleanup-cron-docker-environments\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Easy Container Cleanup in Cron + Docker Environments - System Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"By nature, Docker containers are temporary. Yet as anyone who runs containers via Cron can tell you, it\u2019s not always so great at cleaning up after itself.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.systemcodegeeks.com\/devops\/easy-container-cleanup-cron-docker-environments\/\" \/>\n<meta property=\"og:site_name\" content=\"System Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/systemcodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2018-02-01T15:15:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Ben Cane\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@systemcodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@systemcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ben Cane\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/devops\/easy-container-cleanup-cron-docker-environments\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/devops\/easy-container-cleanup-cron-docker-environments\/\"},\"author\":{\"name\":\"Ben Cane\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/#\/schema\/person\/86302616000bcfa1e56e85bf9e0fb377\"},\"headline\":\"Easy Container Cleanup in Cron + Docker Environments\",\"datePublished\":\"2018-02-01T15:15:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/devops\/easy-container-cleanup-cron-docker-environments\/\"},\"wordCount\":1099,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/devops\/easy-container-cleanup-cron-docker-environments\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg\",\"keywords\":[\"Container\",\"Cron\",\"Docker\"],\"articleSection\":[\"DevOps\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.systemcodegeeks.com\/devops\/easy-container-cleanup-cron-docker-environments\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/devops\/easy-container-cleanup-cron-docker-environments\/\",\"url\":\"https:\/\/www.systemcodegeeks.com\/devops\/easy-container-cleanup-cron-docker-environments\/\",\"name\":\"Easy Container Cleanup in Cron + Docker Environments - System Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/devops\/easy-container-cleanup-cron-docker-environments\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/devops\/easy-container-cleanup-cron-docker-environments\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg\",\"datePublished\":\"2018-02-01T15:15:00+00:00\",\"description\":\"By nature, Docker containers are temporary. Yet as anyone who runs containers via Cron can tell you, it\u2019s not always so great at cleaning up after itself.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/devops\/easy-container-cleanup-cron-docker-environments\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.systemcodegeeks.com\/devops\/easy-container-cleanup-cron-docker-environments\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/devops\/easy-container-cleanup-cron-docker-environments\/#primaryimage\",\"url\":\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg\",\"contentUrl\":\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/devops\/easy-container-cleanup-cron-docker-environments\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.systemcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"DevOps\",\"item\":\"https:\/\/www.systemcodegeeks.com\/category\/devops\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Easy Container Cleanup in Cron + Docker Environments\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/#website\",\"url\":\"https:\/\/www.systemcodegeeks.com\/\",\"name\":\"System Code Geeks\",\"description\":\"Operating System Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.systemcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.systemcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/systemcodegeeks\",\"https:\/\/x.com\/systemcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/#\/schema\/person\/86302616000bcfa1e56e85bf9e0fb377\",\"name\":\"Ben Cane\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/58e760dbb7e91f10c242039f23e9c0f2d82f86e5d10798ad76f2a34820fa06d0?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/58e760dbb7e91f10c242039f23e9c0f2d82f86e5d10798ad76f2a34820fa06d0?s=96&d=mm&r=g\",\"caption\":\"Ben Cane\"},\"description\":\"Benjamin Cane is a systems architect in the financial services industry. He writes about Linux systems administration on his blog and has recently published his first book, Red Hat Enterprise Linux Troubleshooting Guide.\",\"url\":\"https:\/\/www.systemcodegeeks.com\/author\/ben-cane\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Easy Container Cleanup in Cron + Docker Environments - System Code Geeks - 2026","description":"By nature, Docker containers are temporary. Yet as anyone who runs containers via Cron can tell you, it\u2019s not always so great at cleaning up after itself.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.systemcodegeeks.com\/devops\/easy-container-cleanup-cron-docker-environments\/","og_locale":"en_US","og_type":"article","og_title":"Easy Container Cleanup in Cron + Docker Environments - System Code Geeks - 2026","og_description":"By nature, Docker containers are temporary. Yet as anyone who runs containers via Cron can tell you, it\u2019s not always so great at cleaning up after itself.","og_url":"https:\/\/www.systemcodegeeks.com\/devops\/easy-container-cleanup-cron-docker-environments\/","og_site_name":"System Code Geeks","article_publisher":"https:\/\/www.facebook.com\/systemcodegeeks","article_published_time":"2018-02-01T15:15:00+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg","type":"image\/jpeg"}],"author":"Ben Cane","twitter_card":"summary_large_image","twitter_creator":"@systemcodegeeks","twitter_site":"@systemcodegeeks","twitter_misc":{"Written by":"Ben Cane","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.systemcodegeeks.com\/devops\/easy-container-cleanup-cron-docker-environments\/#article","isPartOf":{"@id":"https:\/\/www.systemcodegeeks.com\/devops\/easy-container-cleanup-cron-docker-environments\/"},"author":{"name":"Ben Cane","@id":"https:\/\/www.systemcodegeeks.com\/#\/schema\/person\/86302616000bcfa1e56e85bf9e0fb377"},"headline":"Easy Container Cleanup in Cron + Docker Environments","datePublished":"2018-02-01T15:15:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.systemcodegeeks.com\/devops\/easy-container-cleanup-cron-docker-environments\/"},"wordCount":1099,"commentCount":0,"publisher":{"@id":"https:\/\/www.systemcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.systemcodegeeks.com\/devops\/easy-container-cleanup-cron-docker-environments\/#primaryimage"},"thumbnailUrl":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg","keywords":["Container","Cron","Docker"],"articleSection":["DevOps"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.systemcodegeeks.com\/devops\/easy-container-cleanup-cron-docker-environments\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.systemcodegeeks.com\/devops\/easy-container-cleanup-cron-docker-environments\/","url":"https:\/\/www.systemcodegeeks.com\/devops\/easy-container-cleanup-cron-docker-environments\/","name":"Easy Container Cleanup in Cron + Docker Environments - System Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.systemcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.systemcodegeeks.com\/devops\/easy-container-cleanup-cron-docker-environments\/#primaryimage"},"image":{"@id":"https:\/\/www.systemcodegeeks.com\/devops\/easy-container-cleanup-cron-docker-environments\/#primaryimage"},"thumbnailUrl":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg","datePublished":"2018-02-01T15:15:00+00:00","description":"By nature, Docker containers are temporary. Yet as anyone who runs containers via Cron can tell you, it\u2019s not always so great at cleaning up after itself.","breadcrumb":{"@id":"https:\/\/www.systemcodegeeks.com\/devops\/easy-container-cleanup-cron-docker-environments\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.systemcodegeeks.com\/devops\/easy-container-cleanup-cron-docker-environments\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.systemcodegeeks.com\/devops\/easy-container-cleanup-cron-docker-environments\/#primaryimage","url":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg","contentUrl":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.systemcodegeeks.com\/devops\/easy-container-cleanup-cron-docker-environments\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.systemcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"DevOps","item":"https:\/\/www.systemcodegeeks.com\/category\/devops\/"},{"@type":"ListItem","position":3,"name":"Easy Container Cleanup in Cron + Docker Environments"}]},{"@type":"WebSite","@id":"https:\/\/www.systemcodegeeks.com\/#website","url":"https:\/\/www.systemcodegeeks.com\/","name":"System Code Geeks","description":"Operating System Developers Resource Center","publisher":{"@id":"https:\/\/www.systemcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.systemcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.systemcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.systemcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.systemcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.systemcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/systemcodegeeks","https:\/\/x.com\/systemcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.systemcodegeeks.com\/#\/schema\/person\/86302616000bcfa1e56e85bf9e0fb377","name":"Ben Cane","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.systemcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/58e760dbb7e91f10c242039f23e9c0f2d82f86e5d10798ad76f2a34820fa06d0?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/58e760dbb7e91f10c242039f23e9c0f2d82f86e5d10798ad76f2a34820fa06d0?s=96&d=mm&r=g","caption":"Ben Cane"},"description":"Benjamin Cane is a systems architect in the financial services industry. He writes about Linux systems administration on his blog and has recently published his first book, Red Hat Enterprise Linux Troubleshooting Guide.","url":"https:\/\/www.systemcodegeeks.com\/author\/ben-cane\/"}]}},"_links":{"self":[{"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/posts\/3413","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/users\/36"}],"replies":[{"embeddable":true,"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/comments?post=3413"}],"version-history":[{"count":0,"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/posts\/3413\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/media\/390"}],"wp:attachment":[{"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/media?parent=3413"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/categories?post=3413"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/tags?post=3413"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}