Developing with Docker on Windows
Installation
First install chocolatey
Then choco install docker-for-windows
Install vscode plugin Docker
Run a Dockerfile from vscode
Open “Docker Desktop” from start menu, and wait for the popup “Docker Desktop is now up and running”
In vscode right click Dockerfile -> Build -> hit enter to give it the default name.
In vscode on the Docker plugin tab, right click the image -> run interactive.
CLI Snippets
Take a look here for some fairly decent snippets.
Build a Docker Image
docker build -t image123 .
Run a Docker Container, and Open a Shell
docker run -it --name container123 image123
Run a Docker Container, Exposed on Port 25000, With An EntryPoint Defined in *.dll, and Delete the Container After Exiting the Shell
docker run -it -d --name container123 -p 25000:80 --entrypoint="dotnet" image123 YourAssemblyWithAnEntryPoint.dll
Inspect a Docker Containers’ File System That is Already Deployed
# list the running docker containers, look for the {containerid} for your container
docker ps -a -q
# create a snapshot, run it and open a shell
docker commit {containerid} mysnapshot
docker run -t -i mysnapshot /bin/bash
# when finished inspecting, delete the snapshot with:
docker rmi mysnapshot
Delete All Docker Images (dev machine only)
docker stop $(docker ps -q)
# a more brutal way of stopped a container than the above
docker kill $(docker ps -q)
docker rmi $(docker images -q)
Inspect the entire docker configuration, including port bindings/forwarding
docker inspect {containername}