multi container in a pod and localhost lookup

Neeraj Agrawal
Apr 11, 2020

--

  • Create a pod with 2 containers
  • If you have docker for mac, go inside hyperkit
  • screen ~/Library/Containers/com.docker.docker/Data/vms/0/tty
  • list all processes running ps -ef, find the ones which were started by your pod. In pod spec above the process id are 12913( nginx)and 12981 (the tail commad running in alpine )
  • List namespaces for each process id

lsns -t net -o NS,TYPE,PATH,NPROCS,PID,PPID,COMMAND,UID,USER

  • notice that processes have same namespace id for net and ipc, they are essentially in same “container” and hence localhost lookup is possible

References

--

--

Neeraj Agrawal

Software Engineer & Architect who knows Java, SQL, Docker, microservice, Kubernetes and AWS. https://www.linkedin.com/in/neeraj-agrawal-39b0105/