protected override async Task ProcessRecordAsync()
        {
            foreach (var id in ParameterResolvers.GetContainerIds(Container, ContainerIdOrName))
            {
                ContainerAttachParameters attachParams = null;
                if (this.Attach)
                {
                    attachParams = new ContainerAttachParameters
                    {
                        Stdin  = this.Input,
                        Stdout = true,
                        Stderr = true,
                        Stream = true
                    };
                }

                var cDetail = await DkrClient.Containers.InspectContainerAsync(id);

                await ContainerOperations.StartContainerAsync(
                    this.DkrClient,
                    id,
                    attachParams,
                    cDetail.Config.Tty,
                    null,
                    this.CmdletCancellationToken);

                if (PassThru)
                {
                    WriteObject((await ContainerOperations.GetContainersByIdOrName(id, DkrClient)).Single());
                }
            }
        }
示例#2
0
        protected override async Task ProcessRecordAsync()
        {
            foreach (var id in ParameterResolvers.GetContainerIds(Container, ContainerIdOrName))
            {
                if (Force)
                {
                    await DkrClient.Containers.KillContainerAsync(
                        id,
                        new ContainerKillParameters());
                }
                else
                {
                    if (!await DkrClient.Containers.StopContainerAsync(
                            id,
                            new ContainerStopParameters(),
                            CmdletCancellationToken))
                    {
                        throw new ApplicationFailedException("The container has already stopped.");
                    }
                }

                if (PassThru)
                {
                    WriteObject((await ContainerOperations.GetContainersByIdOrName(id, DkrClient)).Single());
                }
            }
        }
        protected override async Task ProcessRecordAsync()
        {
            foreach (var id in ParameterResolvers.GetContainerIds(Container, Id))
            {
                if (!await DkrClient.Containers.StartContainerAsync(id, new ContainerStartParameters()))
                {
                    throw new ApplicationFailedException("The container has already started.");
                }

                if (PassThru)
                {
                    WriteObject((await ContainerOperations.GetContainersByIdOrName(id, DkrClient)).Single());
                }
            }
        }
示例#4
0
        protected override async Task ProcessRecordAsync()
        {
            foreach (var id in ParameterResolvers.GetContainerIds(Container, Id))
            {
                var waitResponse = await DkrClient.Containers.WaitContainerAsync(
                    id,
                    CmdletCancellationToken);

                WriteVerbose("Status Code: " + waitResponse.StatusCode.ToString());
                ContainerOperations.ThrowOnProcessExitCode(waitResponse.StatusCode);

                if (PassThru)
                {
                    WriteObject((await ContainerOperations.GetContainersByIdOrName(id, DkrClient)).Single());
                }
            }
        }
 /// <summary>
 /// Outputs container objects for each container matching the provided parameters.
 /// </summary>
 protected override async Task ProcessRecordAsync()
 {
     if (Id != null)
     {
         foreach (var id in Id)
         {
             WriteObject(await ContainerOperations.GetContainersByIdOrName(id, DkrClient));
         }
     }
     else
     {
         foreach (var c in await DkrClient.Containers.ListContainersAsync(
                      new ContainersListParameters()
         {
             All = true
         }))
         {
             WriteObject(c);
         }
     }
 }