In some linux installation, sometimes the / or /var directories are not that big, and we would like to have our docker save all the images and containers in another directory.
To set docker to use other directory:
1. Create the new directory (let's say we are using /data/docker )
$ sudo mkdir /data/docker
2. Stop docker daemon
$ sudo systemctl stop docker
3. Create a file called /etc/docker/daemon.json (Edit if the file is already exist)
$ sudo touch /etc/docker/daemon.json
4. Edit and put in below content into the file
{"data-root": "/data/docker"}
5. Save and exit the editor
6. Start docker
$ sudo systemctl start docker
7. Verify that docker is running
$ sudo systemctl status docker
No comments:
Post a Comment