kubernetes - How to stop/start containers at k3s agent?
问题描述
Docker provides the following functions to stop and start the same container.
OP46B1:/ # docker stop 18788407a60c
OP46B1:/ # docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
18788407a60c ubuntu:test "/bin/bash" 34 minutes ago Exited (0) 7 seconds ago charming_gagarin
OP46B1:/ # docker start 18788407a60c
But k3s agent does not provide this function. A container stopped by "k3s crictl stop" cannot be restarted by "k3s crictl start". The following error will appear. How to stop and start the same container at k3s agent?
OP46B1:/data # ./k3s-arm64 crictl stop 5485f899c7bb6
5485f899c7bb6
OP46B1:/data # ./k3s-arm64 crictl ps -a
CONTAINER IMAGE CREATED STATE NAME ATTEMPT POD ID
5485f899c7bb6 b58be220837f0 3 days ago Exited pod-webapp86 0 92a94e8eec410
OP46B1:/data# ./k3s-arm64 crictl start 5485f899c7bb6
FATA[2020-10-20T00:54:04.520056930Z] Starting the container "5485f899c7bb6" failed: rpc error: code = Unknown desc = failed to set starting state for container "5485f899c7bb6f2d294a3a131b33d8f35c9cf84df73cacb7b8af1ee48a591dcf": container is in CONTAINER_EXITED state
解决方案
推荐阅读
- react-native - 无法初始化 React-Native 上下文并保留调度方法
- javascript - 如何编写依赖于反应查询调用的自定义钩子
- html - Webkit 滚动条 CSS 没有改变
- postgresql - Postgres 不同的速记
- sas - SAS Studio 问题 - mySASObjectServer 访问被拒绝
- python - 在 FreeCAD 模型中使用点密度函数对孔进行建模
- javascript - 在javascript中过滤二维数组
- python - PCA 决策面上的标签点 - SVM
- reactjs - 如果 npm start 未运行,则反应站点在域上给出 502 Bad Gateway,nginx
- uml - 您是否允许在类或活动图中使用门户?