mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
daemon: Daemon.getPidContainer: change to accept "id" argument
This function didn't need the whole container, only its ID, so let's use that as argument. This also makes it consistent with getIpcContainer. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -86,8 +86,7 @@ func (daemon *Daemon) getIpcContainer(id string) (*container.Container, error) {
|
||||
return ctr, nil
|
||||
}
|
||||
|
||||
func (daemon *Daemon) getPidContainer(ctr *container.Container) (*container.Container, error) {
|
||||
id := ctr.HostConfig.PidMode.Container()
|
||||
func (daemon *Daemon) getPIDContainer(id string) (*container.Container, error) {
|
||||
ctr, err := daemon.GetContainer(id)
|
||||
if err != nil {
|
||||
return nil, errdefs.InvalidParameter(err)
|
||||
|
||||
@@ -326,7 +326,7 @@ func WithNamespaces(daemon *Daemon, c *container.Container) coci.SpecOpts {
|
||||
}
|
||||
switch {
|
||||
case pidMode.IsContainer():
|
||||
pc, err := daemon.getPidContainer(c)
|
||||
pc, err := daemon.getPIDContainer(pidMode.Container())
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to join PID namespace")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user