Skip to content

Add support for 'docker exec' - phase 2#8062

Merged
LK4D4 merged 12 commits intomoby:masterfrom
vishh:run_in_phase2
Sep 16, 2014
Merged

Add support for 'docker exec' - phase 2#8062
LK4D4 merged 12 commits intomoby:masterfrom
vishh:run_in_phase2

Conversation

@vishh
Copy link
Copy Markdown
Contributor

@vishh vishh commented Sep 16, 2014

Closes #7409
Fixes #6777
Fixes #1228

Daemon now supports resizing of tty sessions used for exec.
'exec' Remote API introduced in #7409 has been split into '/containers//exec' and '/exec//start'.
'/exec//resize' has been added to support resizing of exec tty sessions.

Modified Attach() method to support docker exec.

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)
Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <[email protected]> (github: vishh)
…' feature.

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)
Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <[email protected]> (github: vishh)
… resizing of

tty sessions for exec'ed commands.

Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <[email protected]> (github: vishh)
…rt resizing of tty sessions.

1. /container/<name>/exec - Creates a new exec command instance in the daemon and container '<name>'. Returns an unique ID for each exec command.
2. /exec/<name>/start - Starts an existing exec command instance. Removes the exec command from the daemon once it completes.

Adding /exec/<name>/resize to resize tty session of an exec command.

Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <[email protected]> (github: vishh)
…exec command.

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

vishh commented Sep 16, 2014

Ping @crosbymichael, @vieux, @tianon

@vishh
Copy link
Copy Markdown
Contributor Author

vishh commented Sep 16, 2014

Ping @fredlf @SvenDowideit for docs/*

@jessfraz
Copy link
Copy Markdown
Contributor

nice!!! trying it out now!

@jessfraz
Copy link
Copy Markdown
Contributor

resize works well 👍

Comment thread api/client/utils.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 am not the biggest fan of this, but also can't think of a more elegant way..

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.

I tried to avoid unnecessary code duplication.

@crosbymichael
Copy link
Copy Markdown
Contributor

Docs were approved for this in the previous PR, no additional review is needed there

@jessfraz
Copy link
Copy Markdown
Contributor

LGTM

Comment thread daemon/attach.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.

Aha, again += 1 :)

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.

Fixed.

@crosbymichael
Copy link
Copy Markdown
Contributor

LGTM

@tiborvass
Copy link
Copy Markdown
Contributor

Tested with different user privileges and caps, with different tty/stdin flags: all good. Did not review code.

@LK4D4
Copy link
Copy Markdown
Contributor

LK4D4 commented Sep 16, 2014

Usage: docker exec [OPTIONS] [OPTIONS] CONTAINER COMMAND [ARG...]

Why two [OPTIONS]?

Comment thread api/client/commands.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.

per @LK4D4's comment you need to remove [OPTIONS] here it gets added automatically.

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

Fixed a bug in daemon that resulted in accessing of a closed pipe.

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

vishh commented Sep 16, 2014

@LK4D4: Good catch. Fixed it.

@LK4D4
Copy link
Copy Markdown
Contributor

LK4D4 commented Sep 16, 2014

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Run in support in docker running a different command on an existing container

5 participants