# docker network create Command Reference

> Reference for docker network create in CI: create a user-defined bridge network so containers can reach each other by name for integration tests in pipelines.

Source: https://latchkey.dev/learn/command-reference/docker-network-create-command-reference  
Updated: 2026-06-26

Create a user-defined network.

docker network create makes a user-defined network, usually a bridge, on which containers can resolve each other by name via Docker DNS. In CI it wires up a service container and a test container so the tests can reach the service by hostname.

## Common flags

- `-d, --driver` - network driver, e.g. bridge (default) or overlay
- `--subnet` - assign a custom subnet, e.g. 172.30.0.0/16
- `--gateway` - set the gateway for the subnet
- `--internal` - restrict external access from the network
- `--attachable` - allow standalone containers to attach (overlay)

## Example

```shell
docker network create ci-net
docker run -d --name db --network ci-net postgres:16
docker run --rm --network ci-net -e DB_HOST=db myorg/app npm run test:integration
```

## In CI

On a user-defined bridge, containers reach each other by container name (here, db) rather than by IP, which keeps test config stable across runs. The default bridge does not provide name resolution, so always create a network for multi-container tests. docker compose creates one automatically.

## FAQ

### docker network create Command Reference?

docker network create makes a user-defined network, usually a bridge, on which containers can resolve each other by name via Docker DNS. In CI it wires up a service container and a test container so the tests can reach the service by hostname.

### In CI?

On a user-defined bridge, containers reach each other by container name (here, db) rather than by IP, which keeps test config stable across runs. The default bridge does not provide name resolution, so always create a network for multi-container tests. docker compose creates one automatically.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
