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?

  • Docker, install postgresql in a container contain “ubuntu:14.04”, lost when out of the container
  • Fixed issue with connecting to docker but don't know why the fix worked
  • Using iPython with remote docker container in a local project directory
  • Oracle DB+Weblogic in a single container
  • Automate iOS application with Appium in Docker
  • Container exits immediately in detached mode
  • Nginx behind Traefik Docker Swarm mode real ip
  • nginx windows 10 upstream timeout
  • How to run custom Docker file?
  • How do docker containers resolve hostname of other docker containers running on the same machine?
  • Dockerfile - Angular2
  • How to add bash command completion for Docker on Mac OS X?
  • 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.