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 thedockermodule afterfilesand beforedns. also, the[NOTFOUND=return]setting is recommended before thednsmodule, 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 is64on Linux. longer than that and it's just not happening, sorry bestie. π - the container IDs are case sensitive. meaning
test.dockerandTest.dockercan 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 πβ¨π¦
π¦ where this page comes from
- debian bookworm: libnss-docker 0.02-1.1 Β· LGPL-2.0-or-later
- debian trixie: libnss-docker 0.02-1.1+b2 Β· LGPL-2.0-or-later
- ubuntu jammy: libnss-docker 0.02-1 Β· LGPL-2.0-or-later
- ubuntu noble: libnss-docker 0.02-1.1 Β· LGPL-2.0-or-later
- ubuntu questing: libnss-docker 0.02-1.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms