golang docker sdk中ContainerExecCreate方法ContainerExecStart方法和ContainerExecAttach方法各有什么作用是需要先create再start再attach吗
ContainerExecCreate方法用于创建一个新的exec实例,该实例将在容器中运行指定的命令。该方法返回一个ExecCreateResponse对象,该对象包含新exec实例的ID和其他相关信息。
ContainerExecStart方法用于启动先前创建的exec实例。该方法返回一个ExecStartCheck对象,该对象包含有关exec实例的信息。
ContainerExecAttach方法用于将当前进程附加到正在运行的exec实例中。该方法返回一个ExecAttachResponse对象,该对象包含有关exec实例的输出和错误信息。
是的,需要先使用ContainerExecCreate方法创建一个新的exec实例,然后使用ContainerExecStart方法启动该实例,并最后使用ContainerExecAttach方法将当前进程附加到正在运行的exec实例中。
原文地址: https://www.cveoy.top/t/topic/dxSK 著作权归作者所有。请勿转载和采集!