mirror of https://github.com/docker/docs.git
Merge pull request #2128 from nishanttotla/container-ops-engine-api
Move container rename and remove to engine-api
This commit is contained in:
commit
a91c6e0159
|
@ -913,7 +913,12 @@ func (e *Engine) Create(config *ContainerConfig, name string, pullImage bool, au
|
||||||
|
|
||||||
// RemoveContainer removes a container from the engine.
|
// RemoveContainer removes a container from the engine.
|
||||||
func (e *Engine) RemoveContainer(container *Container, force, volumes bool) error {
|
func (e *Engine) RemoveContainer(container *Container, force, volumes bool) error {
|
||||||
err := e.client.RemoveContainer(container.ID, force, volumes)
|
opts := types.ContainerRemoveOptions{
|
||||||
|
ContainerID: container.ID,
|
||||||
|
Force: force,
|
||||||
|
RemoveVolumes: volumes,
|
||||||
|
}
|
||||||
|
err := e.apiClient.ContainerRemove(context.TODO(), opts)
|
||||||
e.CheckConnectionErr(err)
|
e.CheckConnectionErr(err)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -1218,7 +1223,7 @@ func (e *Engine) StartContainer(id string, hostConfig *dockerclient.HostConfig)
|
||||||
// RenameContainer renames a container
|
// RenameContainer renames a container
|
||||||
func (e *Engine) RenameContainer(container *Container, newName string) error {
|
func (e *Engine) RenameContainer(container *Container, newName string) error {
|
||||||
// send rename request
|
// send rename request
|
||||||
err := e.client.RenameContainer(container.ID, newName)
|
err := e.apiClient.ContainerRename(context.TODO(), container.ID, newName)
|
||||||
e.CheckConnectionErr(err)
|
e.CheckConnectionErr(err)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue