none
How to change docker images and containers location with Windows Containers?

    Question

  • I'm running Windows Hyper-V 2016 Core.

    My Server is set up with a C as a small boot drive, with two other large drives on the machine. When creating docker images and containers, the files get placed in C:\ProgramData\docker\ - can I move that to the D drive? How can I do it from the command line or powershell?

    Thanks

    Saturday, January 14, 2017 3:42 PM

Answers

  • Finally worked it out. Solution here https://github.com/docker/for-win/issues/185

    I added daemon.json to C:\ProgramData\Docker\config and put these lines in it:

    {"graph": "D:\\ProgramData\\Docker"}

    docker info

    Containers: 1
     Running: 1
     Paused: 0
     Stopped: 0
    Images: 1
    Server Version: 1.12.2-cs2-ws-beta
    Storage Driver: windowsfilter
     Windows:
    Logging Driver: json-file
    Plugins:
     Volume: local
     Network: nat null overlay transparent
    Swarm: inactive
    Default Isolation: process
    Kernel Version: 10.0 14393 (14393.693.amd64fre.rs1_release.161220-1747)
    Operating System: Hyper-V Server 2016
    OSType: windows
    Architecture: x86_64
    CPUs: 8
    Total Memory: 31.67 GiB
    Name: LITHIUM
    ID: 3E6V:GYKZ:47RT:UPBB:TUEN:W2OA:7NOV:3XS6:YH7M:GE4B:2NH4:LRFL
    Docker Root Dir: D:\ProgramData\docker
    Debug Mode (client): false
    Debug Mode (server): false
    Registry: https://index.docker.io/v1/
    Insecure Registries:
     127.0.0.0/8
    Live Restore Enabled: false

    • Marked as answer by MarkAllison Tuesday, January 17, 2017 10:29 PM
    Tuesday, January 17, 2017 10:29 PM

All replies

  • I'm running Windows Hyper-V 2016 Core.

    My Server is set up with a C as a small boot drive, with two other large drives on the machine. When creating docker images and containers, the files get placed in C:\ProgramData\docker\ - can I move that to the D drive? How can I do it from the command line or powershell?

    Thanks

    Hi,

    Please try to use Environment.SetEnvironmentVariable to modify the docker directory,for example:[Environment]::SetEnvironmentVariable(“Path”, $env:Path + “;C:\Program
    Files\Docker”, [EnvironmentVariableTarget]::Machine)

    If it doesn't help,please try to re-install docker for windows,and add  the Docker directory in the system path within this procedure,follow this guide:

    Getting Started with Windows Containers

    https://blogs.msdn.microsoft.com/jcorioland/2016/10/13/getting-started-with-windows-containers/


    Best Regards
    Cartman
    Please remember to mark the replies as an answers if they help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Monday, January 16, 2017 5:29 AM
    Moderator
  • I'm a bit lost. This is what I did:

    mkdir D:\Docker
    [System.Environment]::SetEnvironmentVariable("Path",$env:Path + ";D:\Docker", [EnvironmentVariableTarget]::Machine)

    Restarted my session.

    $env:path

    shows the D:\Docker directory.

    Then:

    Get-Service docker | Restart-Service

    and finally:

    docker info
    Containers: 1
     Running: 0
     Paused: 0
     Stopped: 1
    Images: 1
    Server Version: 1.12.2-cs2-ws-beta
    Storage Driver: windowsfilter
     Windows:
    Logging Driver: json-file
    Plugins:
     Volume: local
     Network: nat null overlay
    Swarm: inactive
    Default Isolation: process
    Kernel Version: 10.0 14393 (14393.576.amd64fre.rs1_release_inmarket.161208-2252)
    Operating System: Windows Server 2016 Datacenter
    OSType: windows
    Architecture: x86_64
    CPUs: 2
    Total Memory: 1.114 GiB
    Name: LARUEL
    ID: I2LM:5LKF:RQDN:ZKCJ:Z5V6:TB7C:IW42:ICWQ:RQGP:TIDJ:SYVQ:OLWN
    Docker Root Dir: C:\ProgramData\docker
    Debug Mode (client): false
    Debug Mode (server): false
    Registry: https://index.docker.io/v1/
    Insecure Registries:
     127.0.0.0/8
    Live Restore Enabled: false

    but the Docker Root Dir is the same. Maybe I missed something somewhere.


    • Edited by MarkAllison Monday, January 16, 2017 9:44 PM
    Monday, January 16, 2017 9:43 PM
  • Hi,

    How about a clean re-install from the guide?


    Best Regards
    Cartman
    Please remember to mark the replies as an answers if they help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Tuesday, January 17, 2017 3:27 AM
    Moderator
  • Finally worked it out. Solution here https://github.com/docker/for-win/issues/185

    I added daemon.json to C:\ProgramData\Docker\config and put these lines in it:

    {"graph": "D:\\ProgramData\\Docker"}

    docker info

    Containers: 1
     Running: 1
     Paused: 0
     Stopped: 0
    Images: 1
    Server Version: 1.12.2-cs2-ws-beta
    Storage Driver: windowsfilter
     Windows:
    Logging Driver: json-file
    Plugins:
     Volume: local
     Network: nat null overlay transparent
    Swarm: inactive
    Default Isolation: process
    Kernel Version: 10.0 14393 (14393.693.amd64fre.rs1_release.161220-1747)
    Operating System: Hyper-V Server 2016
    OSType: windows
    Architecture: x86_64
    CPUs: 8
    Total Memory: 31.67 GiB
    Name: LITHIUM
    ID: 3E6V:GYKZ:47RT:UPBB:TUEN:W2OA:7NOV:3XS6:YH7M:GE4B:2NH4:LRFL
    Docker Root Dir: D:\ProgramData\docker
    Debug Mode (client): false
    Debug Mode (server): false
    Registry: https://index.docker.io/v1/
    Insecure Registries:
     127.0.0.0/8
    Live Restore Enabled: false

    • Marked as answer by MarkAllison Tuesday, January 17, 2017 10:29 PM
    Tuesday, January 17, 2017 10:29 PM
  • Hi,

    Thank you for sharing to us.


    Best Regards
    Cartman
    Please remember to mark the replies as an answers if they help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Wednesday, January 18, 2017 2:19 AM
    Moderator
  • Hi,

        I am having the same issue. I could not find Daemon.json file in "C:\ProgramData\docker\config"

    Monday, January 30, 2017 1:42 AM
  • Make one manually. That's what seems to work for me. I'm currently testing this.
    Saturday, February 11, 2017 4:32 PM
  • need more info. what did you do afterwards? did you create the directory and move the current images?

    how do you do this properly?

    >docker system

    Containers: 7
     Running: 7
     Paused: 0
     Stopped: 0
    Images: 3


    Christmas spirit all year long Please remember to vote on useful replies. Mark answers. Help to answer questions of others while you are visting the forums. Thank you.

    Thursday, June 6, 2019 2:10 AM