如何有效管理Colima和Docker

huangapple go评论60阅读模式
英文:

how to manage colima <> docker effectively

问题

我试图学习有关Docker和Colima在Apple Silicon上的更多信息,到目前为止...我了解了它们的基础知识以及它们如何协同工作。但我有一些关于如何管理它的问题,例如:

  • 如何直接停止Colima而不丢失数据/容器?

  • 如何轻松重新启动Colima而不必重新设置一切(Colima实际上会耗费大量RAM)?

  • 如何切换Colima上的默认守护进程?

  • 如何管理守护进程的名称?

  • 如何在特定守护进程上启动Colima开机启动?

  • 如何在不影响Docker的情况下更改Colima上下文?

  • 如何获取Colima守护程序的运行统计信息(CPU和内存使用...与分配不同)?

谢谢您的帮助,如果有任何不清楚或不合理的问题,请随时引用并更正它。

英文:

Im trying to learn more about docker with colima especially on apple-silicon,

so far... I understand the basics of it and how both actually work together.
But I do have some question about how to manage it so far as :

- stopping colima directly without loosing data/containers

>(colima stop [c-id] before or after docker stop&#160;[c-id], is it needed ?)*

- restart colima easily without having to setup everything (colima actually drains a lot of RAM)

>(right now, when ever I stop colima and restart it, I can't see my past containers working running ( I think it is because it stops them too).*

>(Specially for different ARCH, I want to know if there's a way to stop colima and then restart it without having to care about inner dockers container states.)*

- how to switch default Deamon on colima

>(how to switch so far the default deamon whenever we use colima start.)

- manage deamons names

>(I haven't seen any way to rename existing deamons without recreating them on top.)

- how to run colima on boot on a specific deamon

- change colima context without affecting docker

- having stats of colima deamon running (cpu & ram usage...=/= allocated)

Thank you for your help, if any question isn't clear or doesn't make sens, feel free to quote it and correct it.

答案1

得分: 1

  • 当你执行 docker stop [c-id] 时,只有你指定的容器ID会停止。colima stop命令用于停止colima用于Docker的VM。如果你希望容器在守护进程启动时启动,你需要使用docker重启策略

  • 要轻松重新启动colima而无需设置所有内容(colima实际上会占用大量RAM),这是不可能的,正如我上面提到的,重新启动容器是需要应用的。并且使用colima不会丢失任何数据。

  • 如何在colima上切换默认的守护程序。你可以通过运行colima start --edit来更改配置,或者将你的参数传递给终端。Colima默认使用docker,但你可以随时通过运行colima stop; colima start --runtime docker来切换到docker,以及colima stop; colima start --runtime containerd来切换到containerd。

  • 管理守护程序的名称,我不明白这个问题。

  • 如何在特定的守护程序上启动时启动colima。我之前看到过这个功能请求,但我认为这个功能尚未发布。

  • 更改colima上下文而不影响docker,你指的是更改colima运行时吗?如果是的话,那么你无法在不影响正在运行的容器的情况下执行此操作。请记住,colima为你运行docker引擎,你不能同时使用docker和containerd。

  • 查看运行的colima守护程序的统计信息(CPU和内存使用情况...=/=分配),运行colima status以查看colima VM正在使用的所有资源。

colima团队在文档中做了很好的工作,记录了工具的最重要部分。

英文:

> - stopping colima directly without loosing data/containers

When you execute docker stop [c-id], only the container whose ID you specify will stop. colima stop command is used to stop the VM colima is using for Docker. If you want your containers to start when the daemon starts, you need to use a docker restart policy

> - restart colima easily without having to setup everything (colima actually drains a lot of RAM)

You can't do that, and as I mentioned above, restarting the containers is something you need to apply. You also do not lose any data with colima.

> - how to switch default Deamon on colima

You can either change the configuration by running colima start --edit or pass your arguments to the terminal. Colima defaults to docker, but you can switch at any time by running colima stop; colima start --runtime docker&quot; to use docker and colima stop; colima start --runtime containerd&quot;

> - manage deamons names

I don't understand this question.

> - how to run colima on boot on a specific deamon

I saw the feature request a while ago, but I don't think this feature was released.

> change colima context without affecting docker

What do you mean by change colima context? Are you referring to the runtime? If yes, then you can't do that without impacting the running containers. Keep in mind that colima runs the docker engine for you, and you can't use both docker and containerd

> - having stats of colima deamon running (cpu & ram usage...=/= allocated)

Run colima status to see all resources the colima VM is using.

The colima team did a good job documenting the most important part of the tool.

huangapple
  • 本文由 发表于 2023年2月14日 21:26:13
  • 转载请务必保留本文链接:https://go.coder-hub.com/75448509.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定