Create a Bridge like Network

docker network create -d macvlan --subnet=192.168.0.0/24 --gateway=192.168.0.1 -o parent=eth0 pub_net

– `-d macvlan`: Specifies the Docker network driver as `macvlan`.
– `–subnet=192.168.0.0/24`: Sets the subnet range for the Docker network to `192.168.0.0/24`.
– `–gateway=192.168.0.1`: Defines the default gateway IP address as `192.168.0.1`.
– `-o parent=eth0`: Specifies the physical network interface `eth0` as the parent interface for the `macvlan` network.
– `pub_net`: The name given to the Docker network being created, which is `pub_net`.

To Delete the Bridge interface

docker network rm pub_net

Docker – To View CPU, Memory , Block IO Utilization

docker container stats –format “table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.MemPerc}}\t{{.BlockIO}}”

To Create Docker cointainer with mounted volume & CPU & Memory limits

docker run --name axigen --hostname axigen --network=pub_net --ip 192.168.1.7 --dns 192.168.1.3 -dt -v /docker_data/axigen_stable/var:/axigen/var -e TZ="Asia/Kolkata" --restart unless-stopped --cpus=2 --memory=2g axigen/axigen

The above Docker command runs a container named “axigen” from the “axigen/axigen” image with specific network settings, including a static IP and custom DNS. The container is started in detached mode with limited CPU resources (2 cores) and memory (2GB), set to use the “Asia/Kolkata” timezone, and will automatically restart unless explicitly stopped.

By Abhi

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.