novelkumar  
                
                  
                    September 28, 2020,  3:13pm
                   
                  1 
               
             
            
              I am using a  docker based application which uses containers to provide microservices, Over a long run, my root filesystem is filed up.
Environment:
OS: Ubuntu 18.04.3 LTS server
Up on checking the main files which fills the disk space is /var/lib/docker/ , especially overlay2 directory.
root@ubuntu2:/home/test1# du -sch /var/lib/docker
             
            
              
            
           
          
            
              
                meyay  
              
                  
                    September 28, 2020,  4:32pm
                   
                  2 
               
             
            
              Please add -x to your du command. It will prevent that the virtual overlayfs files will be counted additionaly./dev/mapper/ubuntu2–vg-root for different overlay mounts and shm memory mounts.
This brings us to the next point. If your block device has 14G, from which 11G are used, but /var/lib/docker itself only occupies 4.3G… Can you share what exactly made you conclude that docker would be the reason your harddisk is filled?
             
            
              
            
           
          
            
              
                novelkumar  
              
                  
                    September 28, 2020,  5:10pm
                   
                  3 
               
             
            
              root@ubuntu2:/var/lib/docker# du -sch * |grep  G
             
            
              
            
           
          
            
              
                novelkumar  
              
                  
                    September 28, 2020,  5:10pm
                   
                  4 
               
             
            
              I have only 6 images… why so many file in overlay2 directory
             
            
              
            
           
          
            
              
                novelkumar  
              
                  
                    September 28, 2020,  5:13pm
                   
                  5 
               
             
            
              the df command o/p made me think there are duplicate file since its showing 11G occupied by overlay files. Also i can see so many directories inside overlay2 . What can be the reason.
             
            
              
            
           
          
            
              
                meyay  
              
                  
                    September 28, 2020,  6:03pm
                   
                  6 
               
             
            
              Like I pointed out in my earlier response: your du messurement was and still is wrong…
Let me ask again: how can a 4.3G folder (which will be even less if you messure right) be responsible to fill up a 14G partition?!
May I suggest this free excellent self paced docker traing ?  After the training you should have at least a decent understanding of how docker works and how things work under the hood.
Good luck!
             
            
              
            
           
          
            
              
                novelkumar  
              
                  
                    September 28, 2020,  6:15pm
                   
                  7 
               
             
            
              Ok. Now its showing correct values. It has come down to 7G from 11G in df output. But i did not delete any files.
             
            
              
            
           
          
            
              
                novelkumar  
              
                  
                    September 28, 2020,  6:30pm
                   
                  8 
               
             
            
              root@ubuntu2:/# df -h