Create a Docker Network

Ticker

6/recent/ticker-posts

Create a Docker Network

Question : 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:

 a. Create a docker network named as ecommerce on App Server 3 in Stratos 

 b. Configure it to use macvlan drivers.

 c. Set it to use subnet 10.10.1.0/24 and iprange 10.10.1.3/24.

Please Note :-  Perform the below commands based on your question  server,  user name & other details might differ . So please read task carefully before executing. 
All the Best 👍

Solution:   

1. Login on app server  as per the task  &  Switch to  root user

thor@jump_host /$ ssh banner@stapp03

The authenticity of host 'stapp03 (172.16.238.12)' can't be established.

ECDSA key fingerprint is SHA256:ZixOao4TAd04RydpSWZyhDYG0xWlCBvt5YMnI2PunL0.

ECDSA key fingerprint is MD5:22:3b:f5:1e:4f:e8:e8:2f:fa:f9:51:7b:fe:b0:0f:2a.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added 'stapp03,172.16.238.12' (ECDSA) to the list of known hosts.

banner@stapp03's password:

[banner@stapp03 ~]$ sudo su -

We trust you have received the usual lecture from the local System

Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.

    #2) Think before you type.

    #3) With great power comes great responsibility.

[sudo] password for banner:

[root@stapp03 ~]#

2. Check existing network on server

[ [root@stapp03 ~]# docker network ls

NETWORK ID          NAME                DRIVER              SCOPE

bc6221d32cd7        bridge              bridge              local

d7abbedae5f6        host                host                local

ff2f676e4cee        none                null                local

[root@stapp03 ~]#

3. Create a docker network as per the task use network name subnet  & IPrange

[root@stapp03 ~]# docker network create -d macvlan --subnet=10.10.1.0/24 --ip-range=10.10.1.3/24 ecommerce

6d80bd900856588d5935d94700f20ed29b18b10c222c769cacb7dcac732a8870

[root@stapp03 ~]#

4. Validate the task network has been created successfully 

[root@stapp03 ~]# docker network ls

NETWORK ID          NAME                DRIVER              SCOPE

bc6221d32cd7        bridge              bridge              local

6d80bd900856        ecommerce           macvlan             local

d7abbedae5f6        host                host                local

ff2f676e4cee        none                null                local

[root@stapp03 ~]# docker network inspect ecommerce

[

    {

        "Name": "ecommerce",

        "Id": "6d80bd900856588d5935d94700f20ed29b18b10c222c769cacb7dcac732a8870",

        "Created": "2021-07-04T15:41:45.972897183Z",

        "Scope": "local",

        "Driver": "macvlan",

        "EnableIPv6": false,

        "IPAM": {

            "Driver": "default",

            "Options": {},

            "Config": [

                {

                    "Subnet": "10.10.1.0/24",

                    "IPRange": "10.10.1.3/24"

                }

            ]

        },

        "Internal": false,

        "Attachable": false,

        "Ingress": false,

        "ConfigFrom": {

            "Network": ""

        },

        "ConfigOnly": false,

        "Containers": {},

        "Options": {},

        "Labels": {}

    }

]

[root@stapp03 ~]#

5.  Click on Finish & Confirm to complete the task successful

Happy Learning!!!!


Apart from this if you need more clarity,  I have made a  tutorial video on this , please go through and share your comments. Like and share the knowledge



Post a Comment

0 Comments

Latest Posts

KodeKloud Kubernetes Security CKS  Lab Challenge 4 |  Audit-policy | Install & configure falco utility | Inspect the API server audit logs and identify the user