Skip to content

docker container net namespace debug script #19

@san3Xian

Description

@san3Xian

give this script execute permission and add it to your PATH variable

#!/bin/bash
 
############################################
#
#  Author: WILO
#  Todo: syntax check
#        list docker containers and select
#
############################################
 
set -ex
pid=`docker inspect $1 | grep "Pid\"" | grep -oP "(\d)*" `
mkdir -p /var/run/netns
ln -sf /proc/$pid/ns/net /var/run/netns/$1
ip netns exec  $@
rm /var/run/netns/$1

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions