Assistanz
Assistanz

Running Windows Container in Windows 2016

Running Windows Container in Windows 2016

Running Windows Container in Windows 2016

In this blog, we will show you how to running windows container in windows 2016 using docker commands.

 

OVERVIEW

We are using the docker client command docker.exe to run the windows containers in windows 2016. There are many options available in docker command. you can use the help page to find different options about this command.

 

RUN WINDOWS CONTAINER IN AN INTERACTIVE MODE

  •  To run a container in an interactive mode, use the below command.

docker run -it microsoft/nanoserver cmd

In the above example,

docker – Command name

run – sub option of to run the container

-it – To run the container in interactive mode

microsoft/nanoserver – Image name for this container

cmd – To execute the cmd.exe process for interactive experience

image

Note: By default, docker will use the latest images if you are not provide the tag name for the image.

Also, we can provide tag along with the image name as shown below.

docker run –it microsoft/nanoserver:latest cmd

Once docker started successfully it shows the command prompt.

image

  • To stop the container, type exit and press enter.

 

DISCONNECT THE CONTAINER

  • To keep the container in the running mode, press CTRL key+PQ
  • Once you press these keys it will disconnect from the container.

image

 

  • To list the docker process, type the below command.

docker ps

image

 

STOP THE CONTAINER

  •  To stop the container, type below command.

Syntax : docker stop <container ID> or <container name>

Example : docker stop 03

Note : We can use the first two character of container ID for short form.

image

 

  • There are no running containers available now.

image

 

  • To show all the containers including stopped, type the below command.

docker ps –a

image

 

START THE CONTAINER

  • To start the container, type the below command.

Syntax : docker start <container ID> or <container name>

Example : docker start 03

image

 

image

 

SETTING NAME FOR CONTAINER

  • By default,  Microsoft will choose a random name for a container. To set a name while creating the container, type the below command.

image

  • Once the container created successfully, press CTRL+PQ to disconnect from the container. Then type docker ps command to list the container(s).

image

 

  • So we can use the name srv01 to stop, start and delete the containers.

image

 

DELETE A CONTAINER

  • To delete a container, type the below command.

Syntax : docker rm <container ID> or <container name>

Example : docker rm srv01

image

 

  • If you try to delete the running container using rm command it shows the below error.

image

 

  • To delete the running container, type the below command.

Syntax : docker rm –f <container ID> or <container name>

Example : docker rm -f 03

image

 

RUNNING IN DETACH MODE WHILE CREATING THE CONTAINER

  • To run in the detach mode while creating the container, type the below command.

Syntax : docker run –d <container image> <process command>

Example : docker run –d microsoft/nanoserver ping 127.0.0.1 –t

image

 

  • When we list the docker process, we can able to see the container running in background.

image

 

  • To start another process inside a running container, type the below command.

Syntax: docker exec -it <container ID>  or <container name> <process command>

Example: docker exec -it 68 cmd

image

 

  • After few seconds, it shows the command prompt. Type hostname to verify the container.

image

 

  • Type exit to exit from the container. Now execute the docker ps command to view the docker process list.

image

The command which we ran during detach mode is still running in the background.

 

COLLECTING INFORMATION ABOUT CONTAINER

 

  • To view the information about the container, type the below command.

Syntax: docker inspect <container ID> or <container name>

Example : docker inspect 68

image

It shows the information about the container in JSON format.

 

VIDEO

 

Thanks for reading this blog. We hope it will be useful for you to start, stop & delete a windows container in Windows 2016.

Most Popular:

Get The Latest Updates

Subscribe To Our Weekly Newsletter

No spam, notifications only about new products, updates.

DirectAdmin Server Management Plans

Premium Support

24/7 End User Support from your Helpdesk
$ 99 Monthly / Server
  • Unlimited Support Plan
  • 24/7 Emergency Phone
  • Chat Support for Admin
  • Separate Account Manager
  • NDA & SLA
  • SLA Review Meetings
  • FREE Consultancy Services
  • Simple SignUp Process
  • Instant Account Activation
  •  

Platinum Support

24/7 Proactive Support
$ 49 Monthly / Server
  • Unlimited Support Plan
  • 24/7 Emergency Phone
  • Chat Support for Admin
  • Separate Account Manager
  • Advance Proactive Monitoring
  • Guaranteed SLA
  • SLA Review Meetings
  • 3rd Party Application Support
  • FREE Consultancy Services
  • Server Migration Support
  • Weekly Status Report
  • No End User Support
Popular

Unlimited Support

24/7 Support

$ 30 Monthly / Server
  • Unlimited Support Plan
  • 24/7 Support
  • Basic Monitoring
  • 30 Minutes Response Time
  • 4 Hours Resolution time for the Possible Issues
  • Security and Performance Optimization
  • React to Customers queries
  • Simple SignUp Process
  • Instant Account Activation
  • No Third party application support
  • No Migration and End User Support

Cpanel Server Management Plans

Premium Support

24/7 End User Support from your Helpdesk

$ 99 Monthly / Server
  • 24/7 End User White Label Support
  • Unlimited Number of Tickets
  • Chat Support for Admin
  • Separate Account Manager
  • Guaranteed SLA
  • Weekly Status Reports
  • FREE Consultancy Services
  • Simple SignUp Process
  • Instant Account Activation

Platinum Support

24/7 Proactive Server Management
$ 49 Monthly / Server
  • Unlimited Support Plan
  • 24/7 Emergency Phone
  • Chat Support for Admin
  • Separate Account Manager
  • Advance Proactive Monitoring
  • Guaranteed SLA
  • SLA Review Meetings
  • 3rd Party Application Support
  • FREE Consultancy Services
  • Server Migration Support
  • Weekly Status Report
  • No End User Support
Popular

Unlimited Support

24/7 Server Management

$ 29 Monthly / Server
  • Unlimited Admin Tasks
  • 24/7 Support
  • Basic Monitoring
  • 30 Minutes Response time
  • 4 hours Response time for possible issues
  • Security and Performance Optimization
  • React to Customers queries
  • No Third party application support
  • No Migration and End User Support

Cpanel Server Management Plans

Premium Support

24/7 End User Support from your Helpdesk

$ 99 Monthly / Server
  • 24/7 End User White Label Support
  • Unlimited Number of Tickets
  • Chat Support for Admin
  • Separate Account Manager
  • Guaranteed SLA
  • Weekly Status Reports
  • FREE Consultancy Services
  • Simple SignUp Process
  • Instant Account Activation

Platinum Support

24/7 Proactive Server Management
$ 49 Monthly / Server
  • Unlimited Support Plan
  • 24/7 Emergency Phone
  • Chat Support for Admin
  • Separate Account Manager
  • Advance Proactive Monitoring
  • Guaranteed SLA
  • SLA Review Meetings
  • 3rd Party Application Support
  • FREE Consultancy Services
  • Server Migration Support
  • Weekly Status Report
  • No End User Support
Popular

Unlimited Support

24/7 Server Management

$ 29 Monthly / Server
  • Unlimited Admin Tasks
  • 24/7 Support
  • Basic Monitoring
  • 30 Minutes Response time
  • 4 hours Response time for possible issues
  • Security and Performance Optimization
  • React to Customers queries
  • No Third party application support
  • No Migration and End User Support