Skip to main content

Network management

This article refers to Platform v3.1.0. The current Platform version is v3.2.0.

Overview

Docker exposes several network drivers, each with its own trade-offs. On Barbara edge nodes there is also a barbaraServices network that Marketplace apps share, so that your own apps can address them by service name (mqttbbr, …) instead of guessing IP addresses. This article walks through the network types, the compose syntax for them, and a hands-on Barbara example.

Video walkthrough

Watch this step on YouTube: Using and Configuring Networks.

Docker network drivers

DriverWhat it doesNotes
bridge (default)Containers on the same bridge can reach each other by name. Outbound NAT to the host. Port mapping via -p.Default for docker run. Single-host.
hostThe container shares the host's network stack — no isolation, no port mapping.Linux only. Easy to clash with host services.
overlayMulti-host networking across a Swarm cluster. Encrypted by default.Requires Swarm mode.
macvlanThe container gets its own MAC and appears as a physical device on the LAN.Needs alignment with the physical network.
noneNo networking at all.For isolated workloads.
ipvlanLike macvlan but multiple containers share a MAC with different IPs.VLAN-friendly.

Compose syntax

Define a custom network under networks:, then list it on every service that should join it:

version: '3.8'

services:
filebrowser:
image: filebrowser/filebrowser:latest
networks:
- my_custom_network
ports:
- "8080:80"

app:
image: my_app:latest
networks:
- my_custom_network
depends_on:
- filebrowser

networks:
my_custom_network:
driver: bridge

Services on the same network reach each other by their service name — app would talk to Filebrowser at http://filebrowser.

The barbaraServices network

Every Barbara edge node ships with a shared barbaraServices Docker network. Marketplace apps deployed on the node attach to it automatically. Join your own app to the same network and you can resolve every Marketplace service by name — for example, the Marketplace MQTT Broker is reachable as mqttbbr, no IP lookup required.

Practice — talk to the Marketplace MQTT Broker by service name

We will deploy a tiny Python app that connects to the Marketplace MQTT Broker on the same node by name (mqttbbr) instead of IP.

1. Compose file

version: '3.8'

services:
testapp:
build: ./imageSource
networks:
barbaraServices:

networks:
barbaraServices:
driver: bridge
name: barbaraServices

The name: barbaraServices line tells Compose to attach to the pre-existing barbaraServices network on the node instead of creating a new one.

2. Dockerfile

Create imageSource/Dockerfile:

FROM python:alpine
RUN pip install paho-mqtt
COPY src /app
WORKDIR /app

CMD ["python", "-u", "test.py"]

3. Python client

Create imageSource/src/test.py:

import logging
import paho.mqtt.client as mqtt

logging.basicConfig(
format="%(asctime)s [%(levelname)s] %(message)s",
level=logging.INFO,
datefmt="%Y-%m-%d %H:%M:%S",
)

BROKER = "mqttbbr" # service name on barbaraServices, not an IP
PORT = 8883
TOPIC = "test/topic"
USERNAME = "bbruser"
PASSWORD = "bbrpassword"


def on_connect(client, userdata, flags, rc):
if rc == 0:
logging.info("✅ Connected to MQTT broker!")
client.subscribe(TOPIC)
logging.info(f"📡 Subscribed to topic: {TOPIC}")
else:
logging.error(f"⚠️ Connection failed with code {rc}")


def on_message(client, userdata, msg):
logging.info(f"📩 Message received on '{msg.topic}': {msg.payload.decode()}")


client = mqtt.Client()
client.username_pw_set(USERNAME, PASSWORD)
client.on_connect = on_connect
client.on_message = on_message

logging.info(f"🔌 Connecting to MQTT broker at {BROKER} with authentication...")
client.connect(BROKER, PORT, 60)
client.loop_forever()
warning

Note the broker is addressed by service name (BROKER = "mqttbbr"), not by IP. The barbaraServices network resolves the name to the Marketplace MQTT Broker container running on the same node.

4. Zip and upload

Zip the directory into mqtt.zip, then create a Docker app named mqtt_client in the App Library and upload mqtt.zip as the first version.

5. Make sure the Marketplace MQTT Broker is running

If the MQTT Broker is not already deployed on your node, add it from Barbara Marketplace and deploy it from the Node Details page with default settings.

6. Deploy your app

On the Node Details page, click Add card → Application and pick mqtt_client. Enable logs on the workload card. You should see:

✅ Connected to MQTT broker!

Summary

barbaraServices is the shortcut to interop with Marketplace apps on a Barbara node — join it, address services by name, skip the IP lookup. For pure-host setups, the standard bridge driver is enough; for multi-host clusters, switch to overlay (and a Swarm cluster) covered in the High Availability section.