Exercise Description:

In this exercise, you will learn about the networking of podman. In podman, you can create a customized network using the podman network utility. Using this customized network you can run containers. This exercise will help you to understand container networking. 

Quick example:

Let’s create a custom network using podman and try to deploy the container using the custom network. When we installed podman in our machine that time default network configuration installed on /etc/cni/net.d as 87-podmanbridge.conflist. In addition, the default network name is defined in /usr/share/containers/libpod.conf with the key cni_default_network. In an unaltered libpod.conf, the default network name will be that of the default configuration provided by the package. In podman, the default network is named podman. 

step1: We can create a new network in podman using the following command:

$ podman network create mynetwork

We can also customize the newly created network. refer man podman-network

step2: To check newly created network use :

$ podman network ls

step3: check Ip address of the newly created network. it is stored inside /etc/cni/net.d/mynetwork.conflist.

step4: now run a container using mynetwork bridge

$ podman run -it -d –name mycontainer –network mynetwork httpd

step5: check whether the container is running or not using:

step6: inspect the IP of mycontainer

So this is a way, you can create a customized network and you can use that customized network to run the container. The benefits of this are you can isolate the container using network bridges.

TASK BY TRAINER

Create a custom network mynet1 and launch mysql container in mynet1 network