The useful stuff I use with Docker
(ToDo: Get picture)

UPDATE: The install process has probably been updated; using the commands is probably the same though


Setup

Install

Install Hyper-V - may require restart

Enable-WindowsOptionalFeature -Online -FeatureName:Microsoft-Hyper-V -All

Install chocolatey:
https://chocolatey.org/install

Install Docker

choco install docker-desktop -y

Change drive of hyper-v disks

This is easier if you do it before installing docker so you don’t have to move the DockerDesktop.vhdx hard disk

Changing the drive does slow performance as my D: drive isn’t an SSD, but my C: drive is always low on space!

  1. Stop docker
  2. create D:\Users\Public\Public Documents\Hyper-V\Virtual hard disks
  3. Cut/Paste docker hard disk DockerDesktop.vhdx from C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks
  4. Open Hyper-V manager > Select PC > Actions pane > Hyper-V Settings…
    • Virtual Hard Disks = D:\Users\Public\Documents\Hyper-V\Virtual Hard Disks
  5. Restart Docker
  6. Test with
    docker run -di --rm --name test mcr.microsoft.com/dotnet/framework/sdk
    

Change drive of docker images

https://www.pbworks.net/change-docker-images-location-in-windows/

Do this before you download the first image, evem before the test above

  1. Purge all the images, because is messy to try move them
  2. Stop docker
  3. Create D:\ProgramData\Docker
  4. Edit C:\ProgramData\Docker\config\daemon.json
  5. Add "graph": "D:\\ProgramData\\Docker"
  6. Restart docker
  7. Test with
    docker pull mcr.microsoft.com/dotnet/framework/sdk
    

docker pull

Good images to have:

docker pull mcr.microsoft.com/dotnet/framework/sdk
docker pull mcr.microsoft.com/windows/servercore/iis

docker container

https://docs.docker.com/engine/reference/commandline/container/

docker container ls

docker ps # Lists running containers
docker kill ab1234cd # Kills container - useful with the -rm tag on the running container!
docker ps -a # Lists all containers

docker rm ab123cd # removes container

docker image

https://docs.docker.com/engine/reference/commandline/image/

docker image ls
docker images
docker image rm IMAGE
docker rmi ab123cd # remove image

docker image prune --all --force

docker prune

https://docs.docker.com/config/pruning/

docker container ls
docker volumes ls
docker image ls
docker network ls

docker container prune
docker volumes prune
docker image prune --all --force

docker network ls
# docker system prune --volumes #This is the nuclear option

docker volume

https://docs.docker.com/engine/reference/commandline/volume/

docker run --help
docker volume ls
docker volume inspect
docker volume prune
docker volume rm

docker run

https://docs.docker.com/engine/reference/commandline/run/

docker run --help 
Parameter Note
-d, –detach Run container in background and print container ID
-u, –user 0 Username or UID - 0 is for root
-p, –publish 5901:5901 Publish a container’s port(s) to the host
-e, –env list VNC_RESOLUTION=1900x1175 Set environment variables
–rm Automatically remove the container when it exits
–name testme Assign a name to the container
-v, –volume /D/TempOnHost:/C/TempOnContainer  
-i, –interactive need -it to keep the docker container running! IIS doesn’t need it
-t, –tty Allocate a pseudo-TTY, -it to use putty shell

mssql-server-windows-developer

I can never remember this, and it is really handy!
It looks like the image is at least 2 years old, but I’m using it anyways because I live life on the edge…

Octopus - Running SQL Server Developer in a Windows-based Docker Container

Here is the run goodness:

docker pull microsoft/mssql-server-windows-developer
docker run --rm --name SQLServer -d -p 1433:1433 -e sa_password=Password_01 -e ACCEPT_EULA=Y microsoft/mssql-server-windows-developer

And we can just use Sql Server Management Studio or Azure Data Studio… or heck Database Browser Portable to connect

Credits

  • No names yet

Cheers!