The command to get the IP address of the local server is hostname -i
Code:
hostname -i
This works on all Linux/Unix based Operating systems and Linux containers. Let us see an example
Code:
[admin@devopsrun1 ~]$ hostname -i
fe80::d9f:63d3:593e:31f2%enp0s3 10.0.2.15
10.0.2.15 is the IPV4 address.
fe80::d9f:63d3:593e:31f2 is the IPV6 address

The ifconfig command


To get detailed information, and to show all IP address associated with your server, use ifconfig
Code:
[root@devopsrun1 ~]# ifconfig
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.2.15  netmask 255.255.255.0  broadcast 10.0.2.255
        inet6 fe80::d9f:63d3:5abc:31a2  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:b3:3c:d3  txqueuelen 1000  (Ethernet)
        RX packets 1200  bytes 101231 (98.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 946  bytes 98760 (96.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 32  bytes 2592 (2.5 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 32  bytes 2592 (2.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
I hope this helps!