change PATH for building docker image

This command sudo docker build -t mydocker . build the image in /var/lib/docker. Is there a way to change it to another folder e.g. /home/user1/docker?

  • multiple django requirements with docker
  • Self hosted Drone CI doesn't synchronize my commits with Github
  • Unable to install docker 1.5 on ubuntu 14.04 64bit
  • Obtaining Docker public key.json file
  • Nexus 3 Docker container and Backup
  • Not able to view my simple flask app using uwsgi and Docker
  • Is the latest version of docker from Amazon on ec2 broken?
  • .ebextensions with Docker on elasticbeanstalk
  • Docker SonarQube Qalityprofile
  • Scaling Azure Container Service with private ports on containers
  • DropWizard app cannot be accessed from outside Docker
  • Getting “can't cd” error when when building using dockerfile
  • One Solution collect form web for “change PATH for building docker image”

    You have to restart the docker daemon with the -g option.

    docker -d -g /home/user1/docker


    docker -d --graph="/home/user1/docker" 

    Keep in mind that once you do this, all your images for that docker daemon instance will get stored on /home/user1/docker

    And also that generally the Docker daemon runs a root. So it’s probably better to specify a directory owned by root

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.