Skip to content

Instantly share code, notes, and snippets.

Last active Feb 1, 2022
What would you like to do?
Getting Started with Docker on Windows
  • Containers are about Software!
  • Traditionally we use the following process to run software:
    • Find the software, usually a standalone web site.
    • Download the software, usually a zip file or some sort of installer.
    • Then we install the software, often extracting a zip file or running an installer.
    • Then we run the installed software.
  • You can learn alot about containers by relating them to the process above. Here's what it looks like to run software with containers:
    • Find the software, on Docker Hub.
    • Download the software with docker pull, comes down as an image which is much like a zip file or msi installer. An image is an application packaging format.
    • Instead of installing the software, we create a container. So, a container--a stopped container--is like installed software. Docker unpacks the image onto the computer, creating a container. Note: if you just want to create a container, you can use docker create.
    • Then we run the container which is exactly like running an exe. It's the same thing under the covers!!!
    • We often use docker run to orchestrate all of these steps with one command, how convenient!
  • docker exec can be thought of as running another copy of our installed software, like when we launch an executable twice. For example, two copies of Microsoft Word. Or with MongoDB, we might run two mongo clients. After a container is created and running, we can use docker exec to run multiple applications, or multiple copies of the same app, inside the container.
# DISCLAIMER: I cannot guarantee the safety of any image
# Use your judgement before running software you download from the internet
# Open PowerShell
# 1. nmap (linux container)
# Port scan your home network
# - Replace with your network
# - Don't be scanning networks you don't own!
docker run --rm `
weshigbee/nmap -v
# 2. ffmpeg (linux container)
# - Replace Turkey.mp4 with whatever movie you'd like to turn into an animated gif
# - Turkey Video:
# -
docker run --rm `
# mount host's current directory as /output inside container
--volume ${pwd}:/output `
jrottenberg/ffmpeg -i /output/Turkey.gif
# 3. .NET Core (linux container)
# Make a sample ASP.NET Core web app
mkdir web-dotnet
# - A Get help
docker run --rm \
microsoft/dotnet \
dotnet help new
# - Create web sample
docker run --rm \
--volume $(pwd)/web-dotnet:/workspace \
--workdir /workspace \
microsoft/dotnet \
dotnet new -t web
# - Run shell
docker run --rm \
--volume $(pwd)/web-dotnet:/workspace \
--workdir /workspace \
-p 5000:5000 \
-it \
microsoft/dotnet \
# then run these in bash shell in container:
dotnet restore
export ASPNETCORE_URLS=http://+:5000
dotnet run &
curl localhost:5000

Docker : A front end for managing continers.

# Source:
#replace with the virtual machine name
$vm = "Win10DockerGettingStarted"
#configure virtual processor
Set-VMProcessor -VMName $vm -ExposeVirtualizationExtensions $true -Count 2
#disable dynamic memory
Set-VMMemory $vm -DynamicMemoryEnabled $false -StartupBytes 8GB
#enable mac spoofing
Get-VMNetworkAdapter -VMName $vm | Set-VMNetworkAdapter -MacAddressSpoofing On
# Solitaire static web site
# 1. Use volume mounts to host static site
docker run --rm -it `
-v ${pwd}/app:/usr/share/nginx/html `
-p 8080:80 `
docker run --rm -it `
-v ${pwd}/app:/usr/share/nginx/html `
-p 8080:80 `
# 2. Copy files into container
docker run -d -p 8080:80 --name nginx nginx
docker cp app/. nginx:/usr/share/nginx/html
# 3. Commit container to make an image!
docker commit nginx solitaire:nginx
# 4. Dockerfile (save the two lines below in a file called Dockerfile)
FROM nginx
COPY app /usr/share/nginx/html
# build
docker build -t solitaire:nginx-dockerfile .
# SSMS Management Tools free download:
Copy link

derek987654 commented Dec 31, 2020

In the Docker-Compose module, received an error pulling down sjoerdmulder/teamcity-agent. Had to modify the docker-compose file to request this image instead:

image: jetbrains/teamcity-agent

Then, error when trying to connect to the Postgress database. Had to update the Postgress container definition with this environment setting:


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment