I am running Docker on Ubuntu Linux. I have a Dockerfile
that brings in a lot of data from elsewhere. I put the Dockerfile
on an external drive that I have mounted to the local filesystem (ext4). Then I ran the build from within that external drive filesystem.
docker build -t mycontainer .
I watched the drive usage as the container was building. All of the drive usage was on the root filesystem instead of the attached drive.
I have read some articles on changing the Docker root/base from /var/lib/docker
to another location, but so far all I get is docker.service: Failed with result 'exit-code'
.
I also tried adding the -g options
in the /lib/systemd/system/docker.service
file:
ExecStart=/usr/bin/dockerd -H fd:// # original
ExecStart=/usr/bin/dockerd -g /new/path/docker -H fd:// # updated
This did not help either.
How can I tell Docker to use the external drive?