Overview
Container Kit provides networking capabilities for connecting containers to each other and the outside world. This guide covers network configuration, DNS settings, and connectivity troubleshooting.Container networking in Container Kit uses Apple’s native containerization networking system, which differs from traditional Docker networking.
Understanding Container Networking
Container networking enables:- Container-to-container communication
- Container-to-host communication
- Container-to-internet communication
- Port mapping for external access
- DNS resolution for service discovery
Network Isolation
Each container has:- Its own network namespace
- Isolated network stack
- Virtual network interfaces
- Separate routing table
Network Types
Container Kit supports several network configurations:Default Network
Containers automatically connect to the default network:- Automatic IP assignment
- Container-to-container communication
- Internet access via NAT
- DNS resolution
Bridge Network
The bridge network provides:- Isolated network segment
- Internal IP addresses (e.g., 192.168.65.0/24)
- Port mapping to host
- DNS service for container names
Host Network (Coming Soon)
Containers share the host’s network stack:- No network isolation
- Direct access to host interfaces
- No port mapping needed
- Higher performance
Port Mapping
Expose container ports to the host system and external network.Configure Port Mapping
When creating a container, map ports:Add Port Mappings
In the Port Mapping section, specify:This maps localhost:8080 to port 80 inside the container.
- Host Port - Port on your Mac (e.g., 8080)
- Container Port - Port inside container (e.g., 80)
- Protocol - TCP or UDP
Port Mapping Syntax
Common Port Mappings
| Service | Container Port | Suggested Host Port |
|---|---|---|
| HTTP | 80 | 8080 |
| HTTPS | 443 | 8443 |
| MySQL | 3306 | 3306 |
| PostgreSQL | 5432 | 5432 |
| Redis | 6379 | 6379 |
| MongoDB | 27017 | 27017 |
DNS Configuration
Configure DNS resolution for containers.Container DNS Settings
Containers use DNS for:- Resolving external domain names
- Container-to-container communication by name
- Service discovery
DNS configuration in Container Kit is currently under development. Advanced DNS features will be available in future releases.
Check DNS Configuration
View current DNS settings:Custom DNS Servers (Coming Soon)
In future releases, you’ll be able to:- Configure custom DNS servers
- Set DNS search domains
- Override default DNS resolution
Network Security
Firewall Considerations
macOS firewall may block container traffic:Container Isolation
Best practices for network security:Use localhost binding
Use localhost binding
Bind ports to localhost only when external access isn’t needed:This prevents external network access while allowing local connections.
Minimize exposed ports
Minimize exposed ports
Only expose ports that are absolutely necessary:✅ Good: Map only the web server port (80/443)❌ Bad: Map all ports indiscriminatelyEach exposed port is a potential security risk.
Use non-standard ports
Use non-standard ports
Consider using non-standard ports for services:This reduces automated scanning and attacks targeting default ports.
Container-to-Container Communication
Containers on the same network can communicate with each other.By Container Name (Coming Soon)
In future releases, containers will be able to resolve each other by name:By IP Address
For now, use IP addresses for container-to-container communication:Network Troubleshooting
Test Container Connectivity
Verify network connectivity from within a container:Common Network Issues
Can't access container from browser
Can't access container from browser
If you can’t access a container’s web service:
- Verify the container is running: Check status in Containers tab
- Confirm port mapping is correct: Review container details
- Test locally first:
curl http://localhost:8080 - Check container logs: Look for binding errors
- Verify the application is listening:
netstatinside container - Check firewall settings: System Settings > Network > Firewall
- Port mapping missing or incorrect
- Application not listening on the right interface
- Firewall blocking the connection
- Port already in use by another service
Port conflict errors
Port conflict errors
If you get “port already in use” errors:
- Check what’s using the port:
- Stop the conflicting service or use a different port
- Update the port mapping in container configuration
- Restart the container with the new port
Containers can't reach internet
Containers can't reach internet
If containers have no internet connectivity:
- Test from host: Verify your Mac has internet
- Check DNS:
container exec <id> nslookup google.com - Test ping:
container exec <id> ping 8.8.8.8 - Review network configuration: Container inspect
- Restart containerization service: Settings > System
- Check system DNS settings: System Settings > Network
Containers can't communicate
Containers can't communicate
If containers can’t reach each other:
- Verify both containers are running
- Get container IP addresses: Inspect each container
- Test ping between containers:
- Check port binding: Service must bind to 0.0.0.0, not 127.0.0.1
- Verify firewall rules: Not blocking container traffic
DNS resolution fails
DNS resolution fails
If DNS isn’t working in containers:
- Check system DNS: System Settings > Network > DNS
- Test DNS from host:
nslookup google.com - Inspect container DNS config: Review /etc/resolv.conf
- Try using IP addresses directly: Bypass DNS
- Restart DNS service: May require service restart
Advanced Networking (Coming Soon)
Future releases will include:Custom Networks
- Create isolated networks
- Configure IP ranges and subnets
- Manage network drivers
- Connect containers to multiple networks
Network Policies
- Define firewall rules between containers
- Restrict ingress/egress traffic
- Implement microsegmentation
- Create network security policies
Load Balancing
- Distribute traffic across multiple containers
- Health checks and failover
- Round-robin and least-connections algorithms
- Service discovery and registration
VPN Integration
- Connect containers to VPN networks
- Route traffic through VPN tunnels
- Secure remote access
- Site-to-site connectivity
Best Practices
Document port mappings
Document port mappings
Keep a record of your port mappings:This prevents conflicts and makes configuration clear.
Use environment-specific ports
Use environment-specific ports
Different port ranges for different environments:
- Development: 8000-8999
- Staging: 9000-9999
- Production: Standard ports (80, 443)
Test networking early
Test networking early
Verify networking as soon as containers start:
- Test internet connectivity
- Verify port mappings work
- Check inter-container communication
- Validate DNS resolution
Monitor network usage
Monitor network usage
Keep an eye on network performance:
- Monitor bandwidth usage
- Track connection counts
- Watch for DNS failures
- Log network errors
Network Diagnostics
Diagnostic Commands
Useful commands for network troubleshooting:Network Information
Key information to check:- Container IP address
- Gateway address
- DNS servers
- Port mappings
- Network interfaces
- Routing table
Next Steps
Container Management
Learn container lifecycle management
Image Management
Manage container images
Troubleshooting
Solve common issues
Technical Reference
Explore the Container Kit API