Skip to content
This repository was archived by the owner on Dec 13, 2018. It is now read-only.

Change nsenter to support docker 'runin'#141

Merged
crosbymichael merged 3 commits intodocker-archive:masterfrom
vishh:runin_support
Aug 5, 2014
Merged

Change nsenter to support docker 'runin'#141
crosbymichael merged 3 commits intodocker-archive:masterfrom
vishh:runin_support

Conversation

@vishh
Copy link
Copy Markdown
Contributor

@vishh vishh commented Aug 4, 2014

Refactor nsenter to support docker runin

@vishh
Copy link
Copy Markdown
Contributor Author

vishh commented Aug 4, 2014

Ping @crosbymichael @rjnagal

Comment thread namespaces/nsenter.go
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to have some way to recognize that this is or is not the command we want no?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Look further down in this file and there will be a check for "nsenter".

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, why do we need to parse the flags before that?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats because the flags need to be placed before any other args. I can scan the args and skip if nsenter is not found here. Will update the patch in a bit.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment thread nsinit/cli.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say that nsenter is a "private" command so I'm okay not documenting these since no user should need to call it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@vmarmol
Copy link
Copy Markdown
Contributor

vmarmol commented Aug 5, 2014

LGTM overall, mostly nits

@vishh
Copy link
Copy Markdown
Contributor Author

vishh commented Aug 5, 2014

@vmarmol PTAL

Comment thread namespaces/nsenter.go
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: just return?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to proceed and not return is "nsenter" is encountered in args.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

won't we just return right after the loop?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, right nvm :)

@vmarmol
Copy link
Copy Markdown
Contributor

vmarmol commented Aug 5, 2014

Thanks @vishh! This LGTM.

Comment thread cgroups/cgutil/cgutil.go
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed the cli stuff for cgutil in #142.

@crosbymichael
Copy link
Copy Markdown
Contributor

The only problem that i see is sending the container json via a cli flag but I think @vmarmol is working on using a pipe to send this. If not let me know and i'll fix it

@vishh
Copy link
Copy Markdown
Contributor Author

vishh commented Aug 5, 2014

Yes. The flag needs to be fixed. Is anything else stopping you from merging this patch?

@crosbymichael
Copy link
Copy Markdown
Contributor

Nope, just testing

@crosbymichael
Copy link
Copy Markdown
Contributor

Running nsinit to exec into a docker container I get this error when i exit:

2139ee92bede692c532dd299b2c8f08f0687422eabadbf51d677638575a696e4|⇒ nsinit exec sh
# exit
sh: 1: Cannot set tty process group (No such process)

@thaJeztah
Copy link
Copy Markdown
Member

@crosbymichael I got the same warning when using nsenter, but only when using /bin/sh, not when using bash for shell; jpetazzo/nsenter#15 (comment)

Didn't consider it a big problem at the time, and haven't looked at it further

@crosbymichael
Copy link
Copy Markdown
Contributor

@thaJeztah true, i do not receive the error when running bash

@thaJeztah
Copy link
Copy Markdown
Member

I'm not entirely sure how to place this PR (don't see any docs yet); Is this PR also meant to be used to open an interactive shell in a running container, thus like https://github.com/jpetazzo/nsenter ?

If so, does this functionality;

  • set up all environment variables from inside the container once a session is opened?
  • is able to automatically open/restore the default shell of the container?

I'm sorry if this is just noise, I ran into the above issues when using the nsenter / docker-enter script and hope this functionality can be built into Docker.

For reference how it was solved there, see https://github.com/jpetazzo/nsenter/blob/master/docker-enter

@vishh
Copy link
Copy Markdown
Contributor Author

vishh commented Aug 5, 2014

@thaJeztah This PR is re-factoring existing code without any user visible changes.
'nsinit exec' is expected to continue to work as-is.

@thaJeztah
Copy link
Copy Markdown
Member

@vishh thx. May have been a silly question of my side, thought I was looking at docker issues, but this is the libcontainer repository

@crosbymichael
Copy link
Copy Markdown
Contributor

LGTM

vishh added 3 commits August 5, 2014 22:13
Docker does not require RunIn API. Hence that API has been removed.
nsinit CLI has been modified to work around the nsenter changes.

Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <[email protected]> (github: vishh)
Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <[email protected]> (github: vishh)
Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <[email protected]> (github: vishh)
@crosbymichael
Copy link
Copy Markdown
Contributor

@vishh what did you just change?

@vishh
Copy link
Copy Markdown
Contributor Author

vishh commented Aug 5, 2014

@crosbymichael I did a rebase. Haven't changed code. I was thinking that the cgutil.go issue might have been fixed on HEAD already :)

@crosbymichael
Copy link
Copy Markdown
Contributor

Ok, just checking

crosbymichael pushed a commit that referenced this pull request Aug 5, 2014
Change nsenter to support docker 'runin'
@crosbymichael crosbymichael merged commit f79bccb into docker-archive:master Aug 5, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants