Windows containers only 2019 update : Doing this via dockerd This shows how we can set D:\ProgramData\docker as our directory rather than the default C:\ProgramData\docker by utilizing dockerd CLI's --data-root option which sets the "Root directory of persistent Docker state". See their API for further options sc stop docker cd "C:\Program Files\Docker\Docker\Resources" .\dockerd.exe --unregister-service .\dockerd.exe --register-service --data-root "D:\ProgramData\docker" sc start docker docker info ...
Useful docker commands Cleaning up PS > docker system prune WARNING! This will remove: - all stopped containers - all networks not used by at least one container - all dangling images - all build cache Are you sure you want to continue? [y/N] Stop and remove all containers docker stop $(docker ps -a -q) docker rm $(docker ps -a -q) Commit changes to container and showing history for an image # Create a new image based on changes in ...
Things I've learnt Mapping folder host to container. In this example I will map a directory c:\foo from my host machine to c:\bar on the target container. Notice that I can read/write files in that directory from both the host and the container. Host Machine cd c:\ mkdir foo docker run -it -v c:\foo:c:\bar microsoft/windowsservercore Windows Container cd c:\bar echo helloworld >> myfile.txt type myfile.txt Mapping a volume host ...