Create Windows Containers using Docker In Microsoft Azure

In this article I’ll show you how to create a Windows Server containers using Docker Engine on a container host running windows Server 2016 TP4 Server core.

This article Is part of my new Microsoft Azure section and the 2nd In the series of Windows Containers.

Before I start It’s very Important to note that the entire deployment, management and administration Is done from the Docker Engine which Is a CLI based module loaded In the first article.

Below you will see the basic Docker commands you need to know.

You can also visit the Docker documentation site and the Hello word In containers part.

The Docker commands syntax Is:


Command Details
attach Attach to a running container
build Build an image from a Dockerfile
commit Create a new image from a container’s changes
cp Copy files/folders between a container and the local filesystem
create Create a new container
diff Inspect changes on a container’s filesystem
events Get real time events from the server
exec Run a command in a running container
export Export a container’s filesystem as a tar archive
history Show the history of an image
images List images
import Import the contents from a tarball to create a filesystem image
info Display system-wide information
inspect Return low-level information on a container or image
kill Kill a running container
load Load an image from a tar archive or STDIN
login Register or log in to a Docker registry
logout Log out from a Docker registry
logs Fetch the logs of a container
network Manage Docker networks
pause Pause all processes within a container
port List port mappings or a specific mapping for the CONTAINER
ps List containers
pull Pull an image or a repository from a registry
push Push an image or a repository to a registry
rename Rename a container
restart Restart a container
rm Remove one or more containers
rmi Remove one or more images
run Run a command in a new container
save Save an image(s) to a tar archive
search Search the Docker Hub for images
start Start one or more stopped containers
stats Display a live stream of container(s) resource usage statistics
stop Stop a running container
tag Tag an image into a repository
top Display the running processes of a container
unpause Unpause all processes within a container
version Show the Docker version information
volume Manage Docker volumes
wait Block until a container stops, then print its exit code

To start, from my Server core server I type:

Docker help 

This will display all the Docker commands

To view all Windows containers Images I type:

Docker images

To run a basic Server Core container from my Images I I’ll run the line below:

 docker run --name core -it windowsservercore powershell

Note: the name of the Container will Is core -it mean the container will stay active the container image used will be windowsservercore and the most imprtant part is that powershell which means that once the container is running will start PowerShell

As you can see below, PowerShell started from the Windows Container not the server host

Now I can run PowerShell cmdlets directly on the Windows Container

And If I run a docker command Inside the container I’ll receive and error

To exit the container type:


To view all containers I type:

Docker ps -a

To start a container use:

docker start b96707abdec5

To check status:

docker ps -a

To connect to It again:

docker attach b96707abdec5

In my next article I’ll show you how to manage the containers once you deploy them.