{"id":13833,"date":"2022-10-03T14:21:38","date_gmt":"2022-10-03T14:21:38","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=13833"},"modified":"2025-07-12T05:40:16","modified_gmt":"2025-07-12T05:40:16","slug":"how-to-specify-the-size-limit-while-creating-the-docker-volume","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/how-to-specify-the-size-limit-while-creating-the-docker-volume\/","title":{"rendered":"Docker Tutorials: Specify the size limit while creating the docker volume?"},"content":{"rendered":"\n<p><strong>If you want to use Volume with Containers, please refer this url.<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-embed-wordpress wp-block-embed is-type-wp-embed is-provider-devopsschool-com\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"jI5H27oQ1t\"><a href=\"https:\/\/www.devopsschool.com\/blog\/understand-docker-volume-from-beginner-to-deep-dive-level\/\">Understand docker volume from beginner to deep dive level<\/a><\/blockquote><iframe loading=\"lazy\" title=\"&#8220;Understand docker volume from beginner to deep dive level&#8221; &#8212; DevOpsSchool.com\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" src=\"https:\/\/www.devopsschool.com\/blog\/understand-docker-volume-from-beginner-to-deep-dive-level\/embed\/#?secret=jI5H27oQ1t\" data-secret=\"jI5H27oQ1t\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>Volumes are often a better choice than persisting data in a container\u2019s writable layer, because a volume does not increase the size of the containers using it, and the volume\u2019s contents exist outside the lifecycle of a given container.<\/p>\n\n\n\n<p>When its comes to a question of How to specify the size limit while creating the docker volume?<\/p>\n\n\n\n<p>As we can see it\u2019s possible to create docker volumes with a predefined size and do it from Docker API which is especially useful if you\u2019re creating new volumes from some container with mounted docker socket and don\u2019t have access to the host.<\/p>\n\n\n\n<p>But Currently, Its looks like only tmpfs mounts support disk usage limitations.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"835\" height=\"397\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/05\/limit-while-creating-the-docker-volume.jpg\" alt=\"\" class=\"wp-image-13835\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/05\/limit-while-creating-the-docker-volume.jpg 835w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/05\/limit-while-creating-the-docker-volume-300x143.jpg 300w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/05\/limit-while-creating-the-docker-volume-768x365.jpg 768w\" sizes=\"auto, (max-width: 835px) 100vw, 835px\" \/><\/figure>\n\n\n\n<p>It is possible to specify the size limit while creating the docker volume using size param with &#8211;opt options.<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/devops-school\/471f0d11c49142c61b3fae5eb91caf0f.js\"><\/script>\n\n\n\n<p><strong>Good reference<\/strong><br>https:\/\/medium.com\/@dmitrytk\/limit-docker-volume-size-9859682f4147<\/p>\n\n\n\n<p>Docker Tutorials Fundamental To Advanced-2021 Crash Course:- <a href=\"https:\/\/bit.ly\/3hOIbTB\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/bit.ly\/3hOIbTB<\/a><\/p>\n\n\n<div class=\"epyt-gallery\" data-currpage=\"1\" id=\"epyt_gallery_32142\"><iframe loading=\"lazy\"  id=\"_ytid_37501\"  width=\"760\" height=\"427\"  data-origwidth=\"760\" data-origheight=\"427\" src=\"https:\/\/www.youtube.com\/embed\/?enablejsapi=1&#038;autoplay=0&#038;cc_load_policy=0&#038;cc_lang_pref=&#038;iv_load_policy=1&#038;loop=0&#038;rel=1&#038;fs=1&#038;playsinline=0&#038;autohide=2&#038;theme=dark&#038;color=red&#038;controls=1&#038;disablekb=0&#038;\" class=\"__youtube_prefs__  no-lazyload\" title=\"YouTube player\"  data-epytgalleryid=\"epyt_gallery_32142\"  allow=\"fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen data-no-lazy=\"1\" data-skipgform_ajax_framebjll=\"\"><\/iframe><div class=\"epyt-gallery-list\"><div>Sorry, there was a YouTube error.<\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>If you want to use Volume with Containers, please refer this url. Volumes are often a better choice than persisting data in a container\u2019s writable layer, because a volume does&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[4862],"tags":[],"class_list":["post-13833","post","type-post","status-publish","format-standard","hentry","category-docker"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/13833","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=13833"}],"version-history":[{"count":4,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/13833\/revisions"}],"predecessor-version":[{"id":31439,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/13833\/revisions\/31439"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=13833"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=13833"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=13833"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}