Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Change Docker root directory /var/lib/docker to another location

Abierto
#14 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
45/100
Tipo de issue
Documentación
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
docker, linux

Línea de trabajo

Review the repository's existing organization for programming tips, then verify the Docker commands and storage-driver references in the issue against the linked Docker documentation. Done means the relocation instructions are added in the project's established format and clearly cover stopping, moving, reconfiguring, restarting, and filesystem limitations.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

From:
https://linuxconfig.org/how-to-move-docker-s-default-var-lib-docker-to-another-directory-on-ubuntu-debian-linux

By default, Docker stores most of its data inside the /var/lib/docker directory on Linux systems. There may come a time when you want to move this storage space to a new location. For example, the most obvious reason might be that you’re running out of disk space.

1.How to edit systemd to accommodate new Docker location? stop the service, update config, and restart

$sudo systemctl stop docker.service
$sudo systemctl stop docker.socket

$sudo vim /lib/systemd/system/docker.service

The line we need to edit looks like this:

ExecStart=/usr/bin/dockerd -H fd://

Edit the line by putting a -g and the new desired location of your Docker directory. When you’re done making this change, you can save and exit the file.

# for old docker 
ExecStart=/usr/bin/dockerd -g /mnt/data/docker/ -H fd://

# for newer versions
ExecStart=/usr/bin/dockerd --data-root /mnt/data/docker/ -H fd://  

2.How to move your Docker installation to a new location?

sudo mkdir -p /data/docker
sudo rsync -aqxP /var/lib/docker/ /data/docker

start docker:

$ sudo systemctl daemon-reload
$ sudo systemctl start docker

Note, if you get error of:

Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xeu docker.service" for details.

It may caused by File System not supported by docker. For my case, when I try to save docker data to NAS driver, it failed. For local driver, it works.
The docker data should be stored on a supported backing filesystem as mentioned here:
https://docs.docker.com/engine/storage/drivers/select-storage-driver/#supported-backing-filesystems

Lenguaje dominante
Python
Estrellas
5
Forks
2
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de davideuler/programming-tips

Todos los issues de davideuler/programming-tips

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.