×
Create Transparent Network in Windows Container
Blog Containers

Create Transparent Network in Windows Container

Create Transparent Network in Windows Container

In this blog, we will show you how to create a transparent network in windows container using docker commands.

 

INTRODUCTION

The transparent network allows containers to be on the same network as container host. We need use both PowerShell and docker commands to configure the transparent network for containers.

 

SETTING UP TRANSPARENT NETWORK

  • First, we need to stop the docker service using below command.

stop-service docker

Create Transparent Network in Windows Container

 

  • Delete the existing network before creating the transparent network. Execute the below command.

Get-ContainerNetwork | Remove-ContainerNetwork

Create Transparent Network in Windows Container

 

  • Open C:\ProgramData\docker\config folder.

Create Transparent Network in Windows Container

 

  • Open the daemon.json file and add the below lines.

{
“bridge” : “none”
}

Create Transparent Network in Windows Container

 

  • The above daemon file informs to docker engine that not to built the NAT network while starting the docker service.
  • save and close the file.
  • Start the docker service using start-service docker command.

Create Transparent Network in Windows Container

 

  • There will not be any container network if you execute Get-ContainerNetwork command.

Create Transparent Network in Windows Container

 

CREATING TRANSPARENT NETWORK

  • To create a transparent network, use the below command.

docker network create –d transparent TNET

docker network – Use to create docker networks.

Create – It’s a sub-command to create a network.

-d – which driver to use to create a network. We need to give it as transparent.

TNET – Name for the network.

Create Transparent Network in Windows Container

 

Note : docker network create command is the equivalent to new-containernetwork

 

  • Type Get-ContainerNetwork to the information about the network.

Create Transparent Network in Windows Container

 

  • If we run docker network ls command, you can find network driver information.

Create Transparent Network in Windows Container

 

VERIFYING TRANSPARENT NETWORK

  • Launch new container using the below command.

docker run -it –network=TNET microsoft/nanoserver

 

  • once the container is up and running, type ipconfig to verify the IP settings

Create Transparent Network in Windows Container

 

  • The IP 192.168.233.97 is the physical network in our office. This container got the IP address from the physical DHCP server.

 

  • Also, we will able to ping the internet domain.

Create Transparent Network in Windows Container

 

VIDEO

Thanks for reading this blog. We hope it was useful for you to learn how to configure a transparent network for the container.

2 thoughts on “Create Transparent Network in Windows Container”

  1. When I follow the steps in your document I find that my container does not pick up an IP. I confirmed that the nat driver provides an addressable IP. Am I missing something? Any suggestions would be appreciated.

  2. Hi John,

    Once you disable the bridge network through daemon.json file it looks for DHCP service in your environment. If it’s available then it will acquire an IP from that. Please make sure that you have a DHCP server running in your environment.

    Regards,
    Loges

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.