I am using docker to scale my service.
I know there's a command called
--add--host for adding host into /etc/host
However, I have a bunch of hosts need to be added. It's just too long to launch a docker in this way
docker run -it \ --add-host=testing1.example.com:10.0.0.1 \ --add-host=testing2.example.com:10.0.0.2 \ --add-host=testing3.example.com:10.0.0.3 \ ...
Therefore, I was thinking to create a function to read a mapping file and solve the problem.
The file format is like the following
184.108.40.206 A 220.127.116.11 B 18.104.22.168 C 22.214.171.124 D 126.96.36.199 E 188.8.131.52 F 184.108.40.206 G ...
I am new on shell script and have no idea to start with.