Introduction
This guide explains how to relocate the Docker root directory to a new partition or mount point for an existing Terraform Enterprise installation without needing to perform a full reinstallation.
Expected Outcome
You will successfully move the Docker root directory to a new location and confirm that Terraform Enterprise functions correctly after the change.
Prerequisites
- A running Terraform Enterprise instance
- Access to the Terraform Enterprise host with
sudoprivileges - Docker Community Edition (CE) installed
Use Case
This procedure is necessary when the partition hosting the Docker root directory (/var/lib/docker by default) is running out of disk space, and you need to move it to a location with more capacity.
Procedure
-
SSH into the Terraform Enterprise host and stop the Terraform Enterprise application and Replicated services.
First, stop the Terraform Enterprise application.
# replicatedctl app stop
Next, verify that the application has successfully stopped before proceeding.
# replicatedctl app status
Finally, stop the Replicated services.
# sudo systemctl stop replicated replicated-operator replicated-ui
-
Stop the Docker daemon and its related services.
Stop the Docker service.
# sudo systemctl stop docker
Stop the Docker socket.
# sudo systemctl stop docker.socket
Stop the containerd service.
# sudo systemctl stop containerd
-
Move the contents of the Docker root directory to the new location.
First, confirm the current Docker root directory path.
# docker info -f '{{ .DockerRootDir}}'The output should be
/var/lib/docker.Next, move the directory contents to the new path. This example uses
/appsas the new location.# mv /var/lib/docker/* /apps/
-
Configure Docker to use the new root directory path.
Create or edit the
/etc/docker/daemon.jsonfile using a text editor.# sudo vim /etc/docker/daemon.json
Add the following content to the file, replacing
/appswith your new path.{ "data-root": "/apps" }After saving the file, you can verify that it contains valid JSON.
# python -m json.tool /etc/docker/daemon.json
-
Start Docker and verify the new root directory location.
Start the Docker service.
# sudo systemctl start docker
Confirm that Docker is now using the new path.
# docker info -f '{{ .DockerRootDir}}'The output should show your new path, for example:
/apps
-
Check the Replicated status and start the Terraform Enterprise application.
Verify that Replicated services are ready.
# replicatedctl system status
The expected output is:
{ "Replicated": "ready", "Retraced": "ready" }Finally, start the Terraform Enterprise application.
# replicatedctl app start
Additional Information
- If you encounter issues with Replicated services, refer to the guide on what to do when Replicated services fail to start with exit code 125.