Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attach to container if it was created with --interactive #4271

Merged
merged 1 commit into from
Oct 17, 2019

Conversation

tylarb
Copy link
Contributor

@tylarb tylarb commented Oct 15, 2019

Check to see if the container's start config includes the interactive
flag when determining to attach or ignore stdin stream.

This is in line with behavior of Docker CLI and engine

Signed-off-by: Tyler Ramer [email protected]


Addresses #4259

@openshift-ci-robot openshift-ci-robot added size/XS needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Oct 15, 2019
@openshift-ci-robot
Copy link
Collaborator

Hi @tylarb. Thanks for your PR.

I'm waiting for a containers or openshift member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@tylarb
Copy link
Contributor Author

tylarb commented Oct 15, 2019

/assign @rhatdan

@baude
Copy link
Member

baude commented Oct 15, 2019

/ok-to-test

@openshift-ci-robot openshift-ci-robot added ok-to-test and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Oct 15, 2019
@baude
Copy link
Member

baude commented Oct 15, 2019

i would prefer a better commit message that tells us why we need to change behavior. is it because docker does it or ?

@tylarb
Copy link
Contributor Author

tylarb commented Oct 15, 2019

Suggested re-write of commit message:

Check to see if the container's start config includes the interactive
flag when determining to attach or ignore stdin stream.

This is in line with behavior when creating a container using Docker engine.

Docker does seem to propogate the -i flag for a container created with it:

libpod(stdin_attach)$ docker --version
Docker version 19.03.3-ce, build a872fc2f86
libpod(stdin_attach)$ docker create -it --name centos_test centos
bd62bc6f3804ca2f20200b96dd0551435a19480b46052fc19ec7628ebbe7976d
libpod(stdin_attach)$ docker start -a centos_test
[root@bd62bc6f3804 /]# ls asdfl;kjasdf
^C

vs podman (current version) -

workspace$ podman --version
podman version 1.6.1
workspace$ podman start -a centos_test        
[root@45e4833f49cb /]# %                     # podman stop centos_test in another terminal                                                                                                                                                                                                              
workspace$ lslsldflkj;asdf;ljasdflkjdsfjjf
zsh: command not found: lslsldflkj

On the version of docker I'm using, it does NOT seem to pass stdout... so the command is entered, but the results are not returned, interestingly enough. But this would be a bug in docker, I assume.

Compared to the patch:

[root@localhost bin]# ./podman --version 
podman version 1.6.2-dev

[root@localhost bin]# ./podman create -it --name centos_test centos
5080ccbc5f0f6cec4f0a50fc0e7334d71879b91e86e8768636d3ddf5e1fc6d21

[root@localhost bin]# ./podman start -a centos_test
[root@5080ccbc5f0f /]# ls
bin  dev  etc  home  lib  lib64  lost+found  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var

@tylarb tylarb force-pushed the stdin_attach branch 2 times, most recently from 320a0c5 to 14e905e Compare October 15, 2019 20:04
Check to see if the container's start config includes the interactive
flag when determining to attach or ignore stdin stream.

This is in line with behavior of Docker CLI and engine

Signed-off-by: Tyler Ramer <[email protected]>
@tylarb
Copy link
Contributor Author

tylarb commented Oct 15, 2019

Commit message updated.

@rhatdan
Copy link
Member

rhatdan commented Oct 16, 2019

@mheon @giuseppe PTAL
Thanks @tylarb

@mheon
Copy link
Member

mheon commented Oct 17, 2019

This LGTM

@mheon
Copy link
Member

mheon commented Oct 17, 2019

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 17, 2019
@rhatdan
Copy link
Member

rhatdan commented Oct 17, 2019

/approve

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rhatdan, tylarb

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 17, 2019
@openshift-merge-robot openshift-merge-robot merged commit f2d9a9d into containers:master Oct 17, 2019
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 26, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. ok-to-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants