如何删除docker容器

时间:2018-04-04 03:18:09

标签: docker

我的前任创建了2个docker容器,并使用--link选项将它们链接在一起。

现在我有一个我要继续使用的活动容器,另一个没用。但是,当我尝试启动其中一个时,我得到了

[keith@docker ~]$ sudo docker start ABC
Error response from daemon: Cannot link to a non running container: /XYZ AS 
/ABC/XYZ
Error: failed to start containers: ABC

这里没有帮助https://forums.docker.com/t/how-can-i-remove-the-link-between-a-deleted-container-and-a-live-container/40431

提前致谢!

1 个答案:

答案 0 :(得分:1)

Docker有一个update命令,可用于更新现有容器的设置

$ docker update --help

Usage:  docker update [OPTIONS] CONTAINER [CONTAINER...]

Update configuration of one or more containers

Options:
      --blkio-weight uint16        Block IO (relative
                                   weight), between 10 and
                                   1000, or 0 to disable
                                   (default 0)
      --cpu-period int             Limit CPU CFS (Completely
                                   Fair Scheduler) period
      --cpu-quota int              Limit CPU CFS (Completely
                                   Fair Scheduler) quota
      --cpu-rt-period int          Limit the CPU real-time
                                   period in microseconds
      --cpu-rt-runtime int         Limit the CPU real-time
                                   runtime in microseconds
  -c, --cpu-shares int             CPU shares (relative weight)
      --cpus decimal               Number of CPUs
      --cpuset-cpus string         CPUs in which to allow
                                   execution (0-3, 0,1)
      --cpuset-mems string         MEMs in which to allow
                                   execution (0-3, 0,1)
      --kernel-memory bytes        Kernel memory limit
  -m, --memory bytes               Memory limit
      --memory-reservation bytes   Memory soft limit
      --memory-swap bytes          Swap limit equal to
                                   memory plus swap: '-1' to
                                   enable unlimited swap
      --restart string             Restart policy to apply
                                   when a container exits

但您无法添加或删除链接,如您所见。您需要再次运行新容器。所以简而言之,你所寻找的是不可能的