Create Docker Network
The Nautilus DevOps team needs to set up several docker environments for different applications. One of the team members has been assigned a ticket where he has been asked to create some docker networks to be used later. Complete the task based on the following ticket description:
- Create a docker network named as
blog on App Server 2 in Stratos DC.
- Configure it to use
macvlan drivers.
- Set it to use subnet
10.10.1.0/24 and iprange 10.10.1.0/24.
Steps
Login into app server 2 and run the following command:
docker network create blog -d macvlan --ip-range 10.10.1.0/24 --subnet 10.10.1.0/24
To verify run the following command:
If you need to understand more on docker network command, you can use help:
Good to Know?
Docker Networking
- Purpose: Enable communication between containers and external networks
- Isolation: Network segmentation for security
- Service Discovery: Containers can find each other by name
- Load Balancing: Distribute traffic across container instances
Network Drivers
- bridge: Default driver for single-host networking
- host: Remove network isolation, use host networking
- overlay: Multi-host networking for swarm mode
- macvlan: Assign MAC addresses to containers
- none: Disable networking for container
MACVLAN Driver
- Purpose: Make containers appear as physical devices on network
- MAC Addresses: Each container gets unique MAC address
- VLAN Support: Support for VLAN tagging
- Performance: Direct access to physical network
Network Configuration
- Subnet: IP address range for the network
- IP Range: Subset of subnet for container assignment
- Gateway: Default route for network traffic
- DNS: Custom DNS configuration for containers