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?

  • Ready to run docker images for Spring Cloud Data Flow
  • See the installation log in oracle silent installation on windows
  • Docker, no IPAddress in docker inspect
  • permission issue for collectstatic in docker-compose
  • Redis in docker starts/restarts multiple times?
  • Docker Centos 7 easy_install supervisor ssl issue behind proxy
  • python cannot import module
  • Unable to build Dockerfile Error: Unable to access jarfile /dev/docker-files/billing/wlp-extended-8.5.5.9.jar
  • Dcos on premises , How out side world reach to docker container if we are using mesos-dns?
  • django postgresql password authentication failed for user
  • Issue while installing Mariadb on mcp8 through Docker
  • Google Container Registry access denied when pushing docker container
  • 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
    

    or

    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.