What other `namespace` oriented linux commands are there?How to find the network namespace of a veth peer ifindex?How to move process from one namespace to other?linux namespace, How to connect internet in network namespace?remove link from Linux namespaceWhat are the ways and risks of using linux namespaces as nonroot user?Internet connectivity using linux network namespaceDid the pivot_root() documentation anticipate the feature of mount namespaces?Linux mount namespace hopping considered harmful?Could the mount namespace API effectively be made redundant? What obstacles would there be?Understanding how mount namespaces work in LinuxWhat happens to the mount namespace of an interrupted process

(Codewars) Linked Lists-Sorted Insert

Sampling from Gaussian mixture models, when are the sampled data independent?

Are all players supposed to be able to see each others' character sheets?

How can a demon take control of a human body during REM sleep?

Was it really inappropriate to write a pull request for the company I interviewed with?

Volume of hyperbola revolved about the y -axis

What is Tony Stark injecting into himself in Iron Man 3?

Why is there an extra space when I type "ls" on the Desktop?

Is this Paypal Github SDK reference really a dangerous site?

Which country has more?

Did Amazon pay $0 in taxes last year?

Why restrict private health insurance?

-1 to the power of a irrational number

Why does this boat have a landing pad? (SpaceX's GO Searcher) Any plans for propulsive capsule landings?

Locked Away- What am I?

Why do phishing e-mails use faked e-mail addresses instead of the real one?

Can I negotiate a patent idea for a raise, under French law?

Can one live in the U.S. and not use a credit card?

What does *dead* mean in *What do you mean, dead?*?

Computation logic of Partway in TikZ

Yet another question on sums of the reciprocals of the primes

Logistic regression BIC: what's the right N?

Too soon for a plot twist?

How should I solve this integral with changing parameters?



What other `namespace` oriented linux commands are there?


How to find the network namespace of a veth peer ifindex?How to move process from one namespace to other?linux namespace, How to connect internet in network namespace?remove link from Linux namespaceWhat are the ways and risks of using linux namespaces as nonroot user?Internet connectivity using linux network namespaceDid the pivot_root() documentation anticipate the feature of mount namespaces?Linux mount namespace hopping considered harmful?Could the mount namespace API effectively be made redundant? What obstacles would there be?Understanding how mount namespaces work in LinuxWhat happens to the mount namespace of an interrupted process













0















By other I mean to say that I ran into the command: nsenter and have been thinking that there might be other tools/commands geared to working with and debugging namespaces. Are there? Keep in mind I'm not asking how they work, just looking to get a broader set of tools for working with docker/k8s, etc.



What other namespace oriented linux commands are there?










share|improve this question



















  • 1





    cgroups tag why? namespaces and cgroups are two different things.

    – sourcejedi
    2 days ago












  • Hmm, I guess I've always considered them highly-related. My mistake.

    – lucidquiet
    1 hour ago















0















By other I mean to say that I ran into the command: nsenter and have been thinking that there might be other tools/commands geared to working with and debugging namespaces. Are there? Keep in mind I'm not asking how they work, just looking to get a broader set of tools for working with docker/k8s, etc.



What other namespace oriented linux commands are there?










share|improve this question



















  • 1





    cgroups tag why? namespaces and cgroups are two different things.

    – sourcejedi
    2 days ago












  • Hmm, I guess I've always considered them highly-related. My mistake.

    – lucidquiet
    1 hour ago













0












0








0








By other I mean to say that I ran into the command: nsenter and have been thinking that there might be other tools/commands geared to working with and debugging namespaces. Are there? Keep in mind I'm not asking how they work, just looking to get a broader set of tools for working with docker/k8s, etc.



What other namespace oriented linux commands are there?










share|improve this question
















By other I mean to say that I ran into the command: nsenter and have been thinking that there might be other tools/commands geared to working with and debugging namespaces. Are there? Keep in mind I'm not asking how they work, just looking to get a broader set of tools for working with docker/k8s, etc.



What other namespace oriented linux commands are there?







namespace containers






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 57 mins ago









sourcejedi

24.9k441107




24.9k441107










asked 2 days ago









lucidquietlucidquiet

694277




694277







  • 1





    cgroups tag why? namespaces and cgroups are two different things.

    – sourcejedi
    2 days ago












  • Hmm, I guess I've always considered them highly-related. My mistake.

    – lucidquiet
    1 hour ago












  • 1





    cgroups tag why? namespaces and cgroups are two different things.

    – sourcejedi
    2 days ago












  • Hmm, I guess I've always considered them highly-related. My mistake.

    – lucidquiet
    1 hour ago







1




1





cgroups tag why? namespaces and cgroups are two different things.

– sourcejedi
2 days ago






cgroups tag why? namespaces and cgroups are two different things.

– sourcejedi
2 days ago














Hmm, I guess I've always considered them highly-related. My mistake.

– lucidquiet
1 hour ago





Hmm, I guess I've always considered them highly-related. My mistake.

– lucidquiet
1 hour ago










1 Answer
1






active

oldest

votes


















2















[Are there] other tools/commands geared to working with and debugging namespaces ?




nsenter is the most important one. There are some more, but not very many. I think I can usefully attempt to list them all.




  1. /proc/[pid]/ns/* - You already know about this, because you looked at nsenter. There are a couple more specifics in namespaces(7) :

    • The above files appear as symbolic links. Running readlink / ls -l will show the namespace type, and a unique identifier.

    • You can keep a permanent reference to a namespace by bind-mounting the above files. If you think this sounds a bit weird, I agree with you, but it can be useful in some cases :-).



  2. lsns - It crawls /proc for you, and lists all the different namespaces that are being used.


  3. /proc/[pid]/mountinfo describes the mount namespace. It is documented in proc(5).



    Take care the first time you look at it, because there are many columns. For example, there are two different "options" columns with potentially differing values for rw / ro. The difference is that the column for "mount options" can vary between bind-mounts of the same filesystem.



    findmnt is the standard command to list mounted filesystems. It has an option --task TID - so you can use it to parse the mountinfo file of any process. (A PID value is also a valid TID).



  4. /proc/[pid]/uid_map and /proc/[pid]/gid_map, for user_namespaces.


  5. The ip command used to control network interfaces:


    • ip netns provides some commands for network namespaces specifically. I.e. it just uses the net file in /proc/[pid]/ns/ as described above.


    • ip link can show information about veth peers, including a local identifier for the netns the peer is in. ip netns list-id or lsns -t net will list network namespaces including this local identifier. I'm not exactly sure how you work with these local identifiers, it seems a bit obscure. But I think this QA mentions everything you can do with them: How to find the network namespace of a veth peer ifindex?


    • ip also lets you move an interface from one netns to another. Although that's not so much about debugging.


"I’m looking at you, single binary go containers"



Adapted from How-to Debug a Running Docker Container from a Separate Container :



There is a problem with using nsenter. If you enter the mount namespace of a container, you can only run commands that were included in the container. But the point of Docker containers is that they only need to include the application itself!



The trick is that you can access the files inside the container, using /proc/[pid]/root/. (Documented in proc(5)).



This is very convenient if you have entered the PID namespace of a container, because you can use /proc/1/root/. At that point, you don't have to search for the right PID :-).



Having entered the PID namespace, it could also be quite convenient if you know the process you want to attach a debugger to will be PID 1 (or perhaps PID 2) inside the container :-). Alternatively, if your application/container is multi-process, you can use your favourite ps command to look at the different processes.






share|improve this answer

























  • Probably unshare also deserves mentioning...

    – Danila Kiver
    2 hours ago











  • @DanilaKiver or maybe get the question clarified as extending beyond "working with docker/k8s, etc" :-P. If I can add only unshare then I agree, but I'm not sure. I treated this as an exercise in showing how little more there is to know, at least about the low-level primitives :-).

    – sourcejedi
    2 hours ago











  • @DanilaKiver if you want to inspect a container namespace, you enter the namespace and use the usual system calls. That's almost all you can do.

    – sourcejedi
    2 hours ago











Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f504928%2fwhat-other-namespace-oriented-linux-commands-are-there%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2















[Are there] other tools/commands geared to working with and debugging namespaces ?




nsenter is the most important one. There are some more, but not very many. I think I can usefully attempt to list them all.




  1. /proc/[pid]/ns/* - You already know about this, because you looked at nsenter. There are a couple more specifics in namespaces(7) :

    • The above files appear as symbolic links. Running readlink / ls -l will show the namespace type, and a unique identifier.

    • You can keep a permanent reference to a namespace by bind-mounting the above files. If you think this sounds a bit weird, I agree with you, but it can be useful in some cases :-).



  2. lsns - It crawls /proc for you, and lists all the different namespaces that are being used.


  3. /proc/[pid]/mountinfo describes the mount namespace. It is documented in proc(5).



    Take care the first time you look at it, because there are many columns. For example, there are two different "options" columns with potentially differing values for rw / ro. The difference is that the column for "mount options" can vary between bind-mounts of the same filesystem.



    findmnt is the standard command to list mounted filesystems. It has an option --task TID - so you can use it to parse the mountinfo file of any process. (A PID value is also a valid TID).



  4. /proc/[pid]/uid_map and /proc/[pid]/gid_map, for user_namespaces.


  5. The ip command used to control network interfaces:


    • ip netns provides some commands for network namespaces specifically. I.e. it just uses the net file in /proc/[pid]/ns/ as described above.


    • ip link can show information about veth peers, including a local identifier for the netns the peer is in. ip netns list-id or lsns -t net will list network namespaces including this local identifier. I'm not exactly sure how you work with these local identifiers, it seems a bit obscure. But I think this QA mentions everything you can do with them: How to find the network namespace of a veth peer ifindex?


    • ip also lets you move an interface from one netns to another. Although that's not so much about debugging.


"I’m looking at you, single binary go containers"



Adapted from How-to Debug a Running Docker Container from a Separate Container :



There is a problem with using nsenter. If you enter the mount namespace of a container, you can only run commands that were included in the container. But the point of Docker containers is that they only need to include the application itself!



The trick is that you can access the files inside the container, using /proc/[pid]/root/. (Documented in proc(5)).



This is very convenient if you have entered the PID namespace of a container, because you can use /proc/1/root/. At that point, you don't have to search for the right PID :-).



Having entered the PID namespace, it could also be quite convenient if you know the process you want to attach a debugger to will be PID 1 (or perhaps PID 2) inside the container :-). Alternatively, if your application/container is multi-process, you can use your favourite ps command to look at the different processes.






share|improve this answer

























  • Probably unshare also deserves mentioning...

    – Danila Kiver
    2 hours ago











  • @DanilaKiver or maybe get the question clarified as extending beyond "working with docker/k8s, etc" :-P. If I can add only unshare then I agree, but I'm not sure. I treated this as an exercise in showing how little more there is to know, at least about the low-level primitives :-).

    – sourcejedi
    2 hours ago











  • @DanilaKiver if you want to inspect a container namespace, you enter the namespace and use the usual system calls. That's almost all you can do.

    – sourcejedi
    2 hours ago
















2















[Are there] other tools/commands geared to working with and debugging namespaces ?




nsenter is the most important one. There are some more, but not very many. I think I can usefully attempt to list them all.




  1. /proc/[pid]/ns/* - You already know about this, because you looked at nsenter. There are a couple more specifics in namespaces(7) :

    • The above files appear as symbolic links. Running readlink / ls -l will show the namespace type, and a unique identifier.

    • You can keep a permanent reference to a namespace by bind-mounting the above files. If you think this sounds a bit weird, I agree with you, but it can be useful in some cases :-).



  2. lsns - It crawls /proc for you, and lists all the different namespaces that are being used.


  3. /proc/[pid]/mountinfo describes the mount namespace. It is documented in proc(5).



    Take care the first time you look at it, because there are many columns. For example, there are two different "options" columns with potentially differing values for rw / ro. The difference is that the column for "mount options" can vary between bind-mounts of the same filesystem.



    findmnt is the standard command to list mounted filesystems. It has an option --task TID - so you can use it to parse the mountinfo file of any process. (A PID value is also a valid TID).



  4. /proc/[pid]/uid_map and /proc/[pid]/gid_map, for user_namespaces.


  5. The ip command used to control network interfaces:


    • ip netns provides some commands for network namespaces specifically. I.e. it just uses the net file in /proc/[pid]/ns/ as described above.


    • ip link can show information about veth peers, including a local identifier for the netns the peer is in. ip netns list-id or lsns -t net will list network namespaces including this local identifier. I'm not exactly sure how you work with these local identifiers, it seems a bit obscure. But I think this QA mentions everything you can do with them: How to find the network namespace of a veth peer ifindex?


    • ip also lets you move an interface from one netns to another. Although that's not so much about debugging.


"I’m looking at you, single binary go containers"



Adapted from How-to Debug a Running Docker Container from a Separate Container :



There is a problem with using nsenter. If you enter the mount namespace of a container, you can only run commands that were included in the container. But the point of Docker containers is that they only need to include the application itself!



The trick is that you can access the files inside the container, using /proc/[pid]/root/. (Documented in proc(5)).



This is very convenient if you have entered the PID namespace of a container, because you can use /proc/1/root/. At that point, you don't have to search for the right PID :-).



Having entered the PID namespace, it could also be quite convenient if you know the process you want to attach a debugger to will be PID 1 (or perhaps PID 2) inside the container :-). Alternatively, if your application/container is multi-process, you can use your favourite ps command to look at the different processes.






share|improve this answer

























  • Probably unshare also deserves mentioning...

    – Danila Kiver
    2 hours ago











  • @DanilaKiver or maybe get the question clarified as extending beyond "working with docker/k8s, etc" :-P. If I can add only unshare then I agree, but I'm not sure. I treated this as an exercise in showing how little more there is to know, at least about the low-level primitives :-).

    – sourcejedi
    2 hours ago











  • @DanilaKiver if you want to inspect a container namespace, you enter the namespace and use the usual system calls. That's almost all you can do.

    – sourcejedi
    2 hours ago














2












2








2








[Are there] other tools/commands geared to working with and debugging namespaces ?




nsenter is the most important one. There are some more, but not very many. I think I can usefully attempt to list them all.




  1. /proc/[pid]/ns/* - You already know about this, because you looked at nsenter. There are a couple more specifics in namespaces(7) :

    • The above files appear as symbolic links. Running readlink / ls -l will show the namespace type, and a unique identifier.

    • You can keep a permanent reference to a namespace by bind-mounting the above files. If you think this sounds a bit weird, I agree with you, but it can be useful in some cases :-).



  2. lsns - It crawls /proc for you, and lists all the different namespaces that are being used.


  3. /proc/[pid]/mountinfo describes the mount namespace. It is documented in proc(5).



    Take care the first time you look at it, because there are many columns. For example, there are two different "options" columns with potentially differing values for rw / ro. The difference is that the column for "mount options" can vary between bind-mounts of the same filesystem.



    findmnt is the standard command to list mounted filesystems. It has an option --task TID - so you can use it to parse the mountinfo file of any process. (A PID value is also a valid TID).



  4. /proc/[pid]/uid_map and /proc/[pid]/gid_map, for user_namespaces.


  5. The ip command used to control network interfaces:


    • ip netns provides some commands for network namespaces specifically. I.e. it just uses the net file in /proc/[pid]/ns/ as described above.


    • ip link can show information about veth peers, including a local identifier for the netns the peer is in. ip netns list-id or lsns -t net will list network namespaces including this local identifier. I'm not exactly sure how you work with these local identifiers, it seems a bit obscure. But I think this QA mentions everything you can do with them: How to find the network namespace of a veth peer ifindex?


    • ip also lets you move an interface from one netns to another. Although that's not so much about debugging.


"I’m looking at you, single binary go containers"



Adapted from How-to Debug a Running Docker Container from a Separate Container :



There is a problem with using nsenter. If you enter the mount namespace of a container, you can only run commands that were included in the container. But the point of Docker containers is that they only need to include the application itself!



The trick is that you can access the files inside the container, using /proc/[pid]/root/. (Documented in proc(5)).



This is very convenient if you have entered the PID namespace of a container, because you can use /proc/1/root/. At that point, you don't have to search for the right PID :-).



Having entered the PID namespace, it could also be quite convenient if you know the process you want to attach a debugger to will be PID 1 (or perhaps PID 2) inside the container :-). Alternatively, if your application/container is multi-process, you can use your favourite ps command to look at the different processes.






share|improve this answer
















[Are there] other tools/commands geared to working with and debugging namespaces ?




nsenter is the most important one. There are some more, but not very many. I think I can usefully attempt to list them all.




  1. /proc/[pid]/ns/* - You already know about this, because you looked at nsenter. There are a couple more specifics in namespaces(7) :

    • The above files appear as symbolic links. Running readlink / ls -l will show the namespace type, and a unique identifier.

    • You can keep a permanent reference to a namespace by bind-mounting the above files. If you think this sounds a bit weird, I agree with you, but it can be useful in some cases :-).



  2. lsns - It crawls /proc for you, and lists all the different namespaces that are being used.


  3. /proc/[pid]/mountinfo describes the mount namespace. It is documented in proc(5).



    Take care the first time you look at it, because there are many columns. For example, there are two different "options" columns with potentially differing values for rw / ro. The difference is that the column for "mount options" can vary between bind-mounts of the same filesystem.



    findmnt is the standard command to list mounted filesystems. It has an option --task TID - so you can use it to parse the mountinfo file of any process. (A PID value is also a valid TID).



  4. /proc/[pid]/uid_map and /proc/[pid]/gid_map, for user_namespaces.


  5. The ip command used to control network interfaces:


    • ip netns provides some commands for network namespaces specifically. I.e. it just uses the net file in /proc/[pid]/ns/ as described above.


    • ip link can show information about veth peers, including a local identifier for the netns the peer is in. ip netns list-id or lsns -t net will list network namespaces including this local identifier. I'm not exactly sure how you work with these local identifiers, it seems a bit obscure. But I think this QA mentions everything you can do with them: How to find the network namespace of a veth peer ifindex?


    • ip also lets you move an interface from one netns to another. Although that's not so much about debugging.


"I’m looking at you, single binary go containers"



Adapted from How-to Debug a Running Docker Container from a Separate Container :



There is a problem with using nsenter. If you enter the mount namespace of a container, you can only run commands that were included in the container. But the point of Docker containers is that they only need to include the application itself!



The trick is that you can access the files inside the container, using /proc/[pid]/root/. (Documented in proc(5)).



This is very convenient if you have entered the PID namespace of a container, because you can use /proc/1/root/. At that point, you don't have to search for the right PID :-).



Having entered the PID namespace, it could also be quite convenient if you know the process you want to attach a debugger to will be PID 1 (or perhaps PID 2) inside the container :-). Alternatively, if your application/container is multi-process, you can use your favourite ps command to look at the different processes.







share|improve this answer














share|improve this answer



share|improve this answer








edited 1 min ago

























answered 2 days ago









sourcejedisourcejedi

24.9k441107




24.9k441107












  • Probably unshare also deserves mentioning...

    – Danila Kiver
    2 hours ago











  • @DanilaKiver or maybe get the question clarified as extending beyond "working with docker/k8s, etc" :-P. If I can add only unshare then I agree, but I'm not sure. I treated this as an exercise in showing how little more there is to know, at least about the low-level primitives :-).

    – sourcejedi
    2 hours ago











  • @DanilaKiver if you want to inspect a container namespace, you enter the namespace and use the usual system calls. That's almost all you can do.

    – sourcejedi
    2 hours ago


















  • Probably unshare also deserves mentioning...

    – Danila Kiver
    2 hours ago











  • @DanilaKiver or maybe get the question clarified as extending beyond "working with docker/k8s, etc" :-P. If I can add only unshare then I agree, but I'm not sure. I treated this as an exercise in showing how little more there is to know, at least about the low-level primitives :-).

    – sourcejedi
    2 hours ago











  • @DanilaKiver if you want to inspect a container namespace, you enter the namespace and use the usual system calls. That's almost all you can do.

    – sourcejedi
    2 hours ago

















Probably unshare also deserves mentioning...

– Danila Kiver
2 hours ago





Probably unshare also deserves mentioning...

– Danila Kiver
2 hours ago













@DanilaKiver or maybe get the question clarified as extending beyond "working with docker/k8s, etc" :-P. If I can add only unshare then I agree, but I'm not sure. I treated this as an exercise in showing how little more there is to know, at least about the low-level primitives :-).

– sourcejedi
2 hours ago





@DanilaKiver or maybe get the question clarified as extending beyond "working with docker/k8s, etc" :-P. If I can add only unshare then I agree, but I'm not sure. I treated this as an exercise in showing how little more there is to know, at least about the low-level primitives :-).

– sourcejedi
2 hours ago













@DanilaKiver if you want to inspect a container namespace, you enter the namespace and use the usual system calls. That's almost all you can do.

– sourcejedi
2 hours ago






@DanilaKiver if you want to inspect a container namespace, you enter the namespace and use the usual system calls. That's almost all you can do.

– sourcejedi
2 hours ago


















draft saved

draft discarded
















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f504928%2fwhat-other-namespace-oriented-linux-commands-are-there%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Creating 100m^2 grid automatically using QGIS?Creating grid constrained within polygon in QGIS?Createing polygon layer from point data using QGIS?Creating vector grid using QGIS?Creating grid polygons from coordinates using R or PythonCreating grid from spatio temporal point data?Creating fields in attributes table using other layers using QGISCreate .shp vector grid in QGISQGIS Creating 4km point grid within polygonsCreate a vector grid over a raster layerVector Grid Creates just one grid

What is this called? Old film camera viewer?What makes a good film camera?What to do with an old film camera?What should one look for when buying a used film camera?What is the value and age of this pre-1967 Ricoh 35 mm camera?DSLR recommendation, question about old Canon 35mm film Camera & lensesCan anyone identify the silver rangefinder-style camera in this advertisement?What kind of a Polaroid 600-camera is this?Will an old film camera still work even when not used in a very long time?What is this camera / Can I develop the film?How to fit an action camera into antique (bellows) housing?What to check when buying used and old film bodies?

Why is this plane circling around the Lucknow airport every day?Why do aircraft on Flight Radar 24 jump around randomly sometimes?What airport has this walkway over a taxiway?How does Chicago O'Hare's tower sequence aircraft at peak capacity?Which airport is featured in this Delta commercial?After a crash, for how long is the airport closed?Can a passenger plane stand still in the air, or hover at a fixed location above a ground?What are those trucks towing around, and why?What is this airport outside of Cairo, Egypt?Which US airport has the lowest circling MDH?What is this airport video?