Create a file /etc/rc.local
with the following content:
Let’s make it executable:
Reload the systemd manager configuration:
Then we start the rc-local daemon:
And then we check the status of rc-local to confirm it ran OK:
Paste the following content:
#!/bin/sh
container_id=”25f17a3706d2″
# Define the entries you want to add entries="192.168.1.11 test1.exemple.com 192.168.1.12 test2.exemple.com 192.168.1.13 test3.exemple.com 192.168.1.14 test4.exemple.com" # Add entries to /etc/hosts echo "$entries" | while read entry; do docker exec "$container_id" /bin/sh -c "echo '$entry' >> /etc/hosts" done
————————
edit the
/etc/rc.local
paste:
sh /root/startup.sh
before
exit 0