Added notes
This commit is contained in:
25
howto - change default docker directory.md
Normal file
25
howto - change default docker directory.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# How to move the default /var/lib/docker to another directory for Docker on Linux?
|
||||
|
||||
[How to move the default /var/lib/docker to another directory for Docker on Linux? | DigitalOcean](https://www.digitalocean.com/community/questions/how-to-move-the-default-var-lib-docker-to-another-directory-for-docker-on-linux)
|
||||
|
||||
- Stop the server: `sudo systemctl stop docker`
|
||||
- Create/edit the configuration at `/etc/docker/daemon.json`, for example: `{ "data-root": "/new/path/docker-data-root" }`
|
||||
- Copy your data there:
|
||||
|
||||
```shell
|
||||
sudo cp -axT /var/lib/docker /new/path/docker-data-root
|
||||
```
|
||||
|
||||
(if the target `docker-data-root` directory already exists, make sure you don’t accidentally copy into a `docker` subdirectory).
|
||||
|
||||
- Start the server:
|
||||
|
||||
```shell
|
||||
sudo systemctl start docker
|
||||
```
|
||||
|
||||
- Check everything works:
|
||||
|
||||
```shell
|
||||
sudo docker images
|
||||
```
|
||||
Reference in New Issue
Block a user