Regarding docker networking lab

As I completed the lab now I have some grip on the docker networking concepts but one thing that confuses me is that
Linking two containers where we use the “–link” option why we give “mysql-db:mysql:db” isn’t it supposed to be “mysql-db:webapp” or the other way around?

Docker links facilitate container-to-container communication by updating the recipient container’s /etc/hosts file and setting environment variables, enabling direct and secure interactions, though this feature is deprecated in favour of Docker networks.

so I just need to mention the container name which needs to be linked to the container I want, as I will be running this “link” command from a container which I want to connect to a one

You need to create a network first and then connect the docker container to that network for them to be able to reference each other by name (hostname):

% docker network create nginx
ef217a398a48539cff5923d2acdcb369581401c9bcd53b2b7e97f411a142486d
% docker run -d --name nginx --network nginx nginx 
20c681d786f752a2399ff36c0a3d5509b54aa2c9646197aa3ddc1eed83d182fe
% docker run -ti busybox
/ # wget nginx
wget: bad address 'nginx' 
% docker run -ti --network nginx busybox 
/ # wget nginx
Connecting to nginx (172.18.0.2:80)
saving to 'index.html'
index.html           100% |***********************************************|   615  0:00:00 ETA
'index.html' saved