How to create macvlan n/w AND attach  Container to it (self reference)

How to create macvlan n/w AND attach Container to it (self reference)

Purely for self reference.

First CREATE A DOCKER NETWORK - macvlan parented to a physical network

docker network create -d macvlan -o parent=ens3 \

 --subnet 10.171.4.0/24 \

 --gateway 10.171.4.1 \

 --ip-range 10.171.4.248/29 \

 --aux-address 'host=10.171.4.254' \

 macvlan-test

===============================

Now CREATE a "docker-compose.yaml" to use the newly created network

version: '3.9'

services:

    macvlan-container:

        image: nginx:1.21.5-alpine

        networks:

          macvlan-test:

      

networks:

   macvlan-test:

     name: macvlan-test

================================

docker-compose up -d

Third if you are using OpenStack VM as host for your Docker container - enable the Address pair parameter in the network interface (refer Cover Image)


To view or add a comment, sign in

More articles by Syed Miftahur Rahman

Explore content categories