NSS-DOCKER(8)

πŸ’– NSS-DOCKER πŸ’– (section 8 of the manual, bestie)

okay so welcome to nss-docker, the manual page, section 8, and honestly? it's giving tiny but mighty. ✨


🌸 NAME 🌸

nss-docker β€” an nss module for finding Docker containers πŸ³πŸ’…


✨ SYNOPSIS ✨

libnss_docker.so.2

that's it. that's the whole synopsis. no flags, no arguments, just the library doing its thing. iconic behaviour, honestly. πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

so basically this is a plugin for the GNU Name Service Switch (NSS) functionality of the GNU C Library (glibc), and what it does is give you a whole mechanism for finding Docker containers by their IDs. like, you type a container ID, it finds the container. simple. slay. πŸ”₯

the container names get searched inside a virtual domain name called .docker. that's the little kingdom where all of this lives. 🏰

now β€” and this part matters, bestie, don't skip it β€” the Docker API webservice has to be available as a /var/run/docker.sock socket for the current user. usually that means you have to add the user to the docker system group. no group, no socket, no vibes. that's just how it is. 😭

to actually activate this NSS module, the docker module has to be added to the /etc/nsswitch.conf file, specifically on the hosts: line. ✨

the recommended setup: put the docker module after files and before dns. also, the [NOTFOUND=return] setting is recommended before the dns module, so that DNS doesn't get used as a fallback when the container ID isn't found. it's giving "know when to stop looking" energy. πŸ’…

🌈 EXAMPLE 🌈

πŸŽ€ /etc/nsswitch.conf

hosts: files docker [NOTFOUND=return] dns

look at her. gorgeous. the exact order matters, so copy it character for character, no cap. πŸ’–


πŸ‘€ SEE ALSO πŸ‘€

go read those if you want the full lore. iykyk. πŸ“šβœ¨


πŸ’€ LIMITATIONS πŸ’€

okay so here's the part where we keep it real:

  • the container ID can't be longer than getconf HOST_NAME_MAX β€” which is 64 on Linux. longer than that and it's just not happening, sorry bestie. πŸ™ˆ
  • the container IDs are case sensitive. meaning test.docker and Test.docker can legit return different IP addresses. yes, really. capitalisation is load-bearing. 😭
  • only IPv4 addresses are supported. that's it, that's the whole list of what you get. no IPv6 today. 🫢

πŸ› BUGS πŸ›

if you find a bug, or you're feeling main character energy and want to implement new features, please report it at:

https://github.com/dex4er/nss-docker/issues

they want to hear from you, fr fr. πŸ”₯


πŸ‘‘ AUTHORS πŸ‘‘

Copyright (c) 2015 Piotr Roszatycki <dexter@debian.org>


πŸ’œ COPYING πŸ’œ

nss-docker is distributed under the GNU Lesser General Public License (LGPL 2.1 or greater). legal but make it cute. πŸŽ€


nss-docker β€” this whole page, version vibes from 20 Oct 2015 β€” that's the source and the date, all wrapped up with a bow. thanks for reading, bestie, now go resolve some containers πŸ’–βœ¨πŸ¦‹