title: Saving docker container image to a different directory than root
body: <p>I am using Docker 18.09 and I am trying to build some images for my work. The problem is that the images are always inside the root directory, precisely the <code>/var/lib/docker/overlay2</code> are in <code>/var/docker/</code>. As there isn't enough space in my root directory, so I want to change this default directory to my other disk but none of the solutions I have looked upon the internet have worked for me. </p>
  
  <p>I have gone through these already but none of them are working:</p>
  
  <p><a href="https://forums.docker.com/t/how-do-i-change-the-docker-image-installation-directory/1169" rel="nofollow noreferrer">https://forums.docker.com/t/how-do-i-change-the-docker-image-installation-directory/1169</a></p>
  
  <p><a href="https://medium.com/@ibrahimgunduz34/how-to-change-docker-data-folder-configuration-33d372669056" rel="nofollow noreferrer">https://medium.com/@ibrahimgunduz34/how-to-change-docker-data-folder-configuration-33d372669056</a></p>
  
  <p><a href="https://stackoverflow.com/questions/24309526/how-to-change-the-docker-image-installation-directory">How to change the docker image installation directory?</a></p>