Difficulty: Beginner
Estimated Time: 5 minutes

Weave provides a software network optimized for visualizing and communicating with applications distributed within Docker containers. Using tools and protocols that are familiar to you, Weave’s network topology lets you communicate between containerized apps distributed across multiple networks or hosts more quickly and efficiently

This example deploys Weave Net to provide network connectivity and service discovery using DNS.

  1. You will create a simple application running in two containers on separate hosts.

  2. Deploy an HTTP Server/Microservice on one host without using public ports.

  3. Access the HTTP server/Microservice from a container running on the second host.

The environment has been configured with two clients and two docker hosts, accessible using the hostname docker. The Weave client has already been installed.

In this scenario, we deployed a http web server that can be accessed from containers running on other hosts by using Weave Net.

Launching Weave created a secure and encrypted network between the two hosts. Weave Net is how the containers on different hosts can communicate. As a system needs to scale, additional hosts can be added to the network. Launched containers will still be able to communicate without requiring re-architecture or extra configuration.

Get started with Weave on your local machine using running:

sudo curl -L git.io/weave -o /usr/local/bin/weave
  sudo chmod +x /usr/local/bin/weave
  weave launch
  

More information can be found at https://www.weave.works/install-weave-net/

Don’t stop now! The next scenario will only take about 10 minutes to complete.

Weave Net

Step 1 of 5

Step 1 - Link Two Docker Hosts

The Weave client has already been installed. The first step is to start Weave on each host and create a peer connection. Click the commands to execute them on the hosts.

On the first host, launch weave.

weave launch

On the second host, launch weave with the IP of the first host.

weave launch [[HOST_IP]]

The two hosts are connected to each other. Any subsequent containers launched via Weave are visible to any other containers on the Weave network.

What Just Happened?

Since this is the first time starting Weave, the Docker containers were downloaded for the Weave router before being started.

You can view the status of the host using weave status

Terminal Host 2