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
% docker run -d --name nginx --network nginx nginx 
% docker run -ti busybox
/ # wget nginx
wget: bad address 'nginx' 
% docker run -ti --network nginx busybox 
/ # wget nginx
Connecting to nginx (
saving to 'index.html'
index.html           100% |***********************************************|   615  0:00:00 ETA
'index.html' saved