mirror of
https://github.com/docker/docs.git
synced 2026-04-12 14:25:46 +07:00
Merge pull request #2128 from nishanttotla/container-ops-engine-api
Move container rename and remove to engine-api
This commit is contained in:
@@ -913,7 +913,12 @@ func (e *Engine) Create(config *ContainerConfig, name string, pullImage bool, au
|
||||
|
||||
// RemoveContainer removes a container from the engine.
|
||||
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)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -1218,7 +1223,7 @@ func (e *Engine) StartContainer(id string, hostConfig *dockerclient.HostConfig)
|
||||
// RenameContainer renames a container
|
||||
func (e *Engine) RenameContainer(container *Container, newName string) error {
|
||||
// send rename request
|
||||
err := e.client.RenameContainer(container.ID, newName)
|
||||
err := e.apiClient.ContainerRename(context.TODO(), container.ID, newName)
|
||||
e.CheckConnectionErr(err)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user