Thursday, April 19, 2018

Customizing hosts file in Docker

In a project recently I had a need to add an entry to /etc/hosts and being new to Docker I was surprised to find that hosts is read only. Turns out this is a known issue, but I was able to find a work around. Essentially creating a copy of the library that handles hostname resolution and editing it to replace /etc/hosts with the path of a writable hosts file. Sounds daunting but it isn’t all that scary, here’s the step by step:
  1. Create a writable copy of /etc/hosts somewhere where the path will be the same length. I used /tmp/hosts:
    RUN cp /etc/hosts /tmp/hosts
  2. Then you need to make a copy of libnss_files.so that you can edit:
    RUN mkdir -p -- /lib-override && cp /lib/x86_64-linux-gnu/libnss_files.so.2 /lib-override
  3. Now edit the binary to replace /etc/hosts with the path to the writable hostsfile (ex. /tmp/hosts):
    RUN perl -pi -e 's:/etc/hosts:/tmp/hosts:g' /lib-override/libnss_files.so.2
  4. Finish up by letting the system know where to find the edited binary:
    ENV LD_LIBRARY_PATH /lib-override
  5. RUN echo '127.0.0.1 ola' >> /tmp/hosts

Monday, April 16, 2018

[Xubuntu] Configuring Start menu in Windows key

Go to Application > Settings > Keyboard
Click on the central tab “Keyboard shortcuts”
Click on “Add”
in Command, enter “xfce4-popup-whiskermenu”
Now set it to “Start (Windows)” key. “Super L” value might appear.

How to revert comments Youtube layout?

#see video for details  https://www.youtube.com/watch?v=J0L_nYtNlqs #uBlock Origin  https://chrome.google.com/webstore/detail/ublock-o...