Docker icon

Docker

Manage Docker containers, images, networks, volumes, and daemon metadata with Unix socket, TCP, TLS, or SSH connections

Network → Connect

AI-generated

Summary

Connect a container to a Docker network

Inputs

  • networkId (required) — Network name or ID
  • networkContainerId (required) — Container to attach or detach
  • networkAliases — List of IP address aliases for the endpoint
  • networkIpv4Address — Optional static IPv4 address for the endpoint
  • networkIpv6Address — Optional static IPv6 address for the endpoint
  • networkConnectAdvancedJson — Merged JSON payload allowing overrides of the structured network connect payload

Output shape

object representing the network after connection

The API response from Docker; may include network details or just a success indication.

Examples

Example 1: Attach a container to an existing network with a custom IPv4 address

networkId: 'bridge', networkContainerId: 'myContainer', networkIpv4Address: '172.18.0.2'

Links

Discussion