Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do we change the install location to another drive? #436

Closed
beckerben opened this issue Oct 20, 2023 · 7 comments
Closed

How do we change the install location to another drive? #436

beckerben opened this issue Oct 20, 2023 · 7 comments
Assignees
Labels
question Further information is requested

Comments

@beckerben
Copy link

We are trying to figure out how to install to the "d:" drive rather than the "c:\ProgramData\Docker" and can't figure out how to do this. We tried specifying the DockerPath and DockerDPath parameters but ran into issues with that.

@beckerben beckerben added the question Further information is requested label Oct 20, 2023
@ntrappe-msft ntrappe-msft added the triage New and needs attention label Oct 24, 2023
@fady-azmy-msft
Copy link
Contributor

Hey @beckerben, have you tried using --installation-dir=<path>? This changes the default installation location (C:\Program Files\Docker\Docker).

Source: https://docs.docker.com/desktop/install/windows-install/#install-docker-desktop-on-windows

@beckerben
Copy link
Author

We're installing on a windows server and can't use the docker desktop so are using the install-docker-ce.ps1 script provided in this repo. It doesn't seem to allow us to change the default installation path. We tried hacking it without success.

@fady-azmy-msft
Copy link
Contributor

I see. @brasmith-ms @Howard-Haiyang-Hao is there any limitations to setting DockerPath and DockerDPath to "d:" drive?

@madduci
Copy link

madduci commented Nov 23, 2023

I'm interested in the same feature. Actually giving "D:" for DockerPath and DockerDPath moves the executables in D: drives, but the Images are stored in C:\ProgramData\docker

grafik

@ntrappe-msft ntrappe-msft removed the triage New and needs attention label Dec 6, 2023
@vagokuln-msft
Copy link

Hello, it sounds like you would like to switch your "data-root" to a directory on the D: drive. This can be done adding a configuration file for Docker. Here is a doc that shows how to change the data-root among other configurations. The sample json in the example specifies the alternate path for the data (such as images and containers) to be stored:

{   
"data-root": "d:\docker"
}

Please note that Docker service needs to be restarted after adding/modifying Docker configurations.

A simple powershell function to do this operation may look like this:

function SetupDocker()
{
        $daemonPath = Join-Path $Env:ProgramData "Docker\config\daemon.json"

        if (Test-Path $daemonPath)
        {
            Write-Host "Daemon file exists. Skipping docker set up..."
        }
        else
        {
            Write-Host "Changing docker configurations..."
            Set-Content -Path $daemonPath -Value '{ "data-root": "D:\\docker" }'
            Restart-Service Docker
        }
}

@Howard-Haiyang-Hao
Copy link
Contributor

@beckerben I was able to get the docker data folder created on a different drive. Here are the steps that I took:

  1. dockerd --unregister-service
  2. dockerd --register-service --run-service --data-root e:\docker
  3. net start docker
image

Please let me know if this is anything else that I can help with.

@Howard-Haiyang-Hao
Copy link
Contributor

Howard-Haiyang-Hao commented Jan 3, 2024

To install the docker to a different location, here are the steps:

  1. Download the docker installer:
    image

  2. "Docker Desktop Installer.exe" install --accept-license --backend=windows --always-run-service --windows-containers-default-data-root=d:\dockerdata --installation-dir=d:\docker

If you reboot your host, the docker service many stop working again. Here is a workaround that I did:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

7 participants