Revert container state detection in create()

The _get_container_state() call in create() has no practical effect:
Docker's POST /containers/create only creates the container without
starting it, so a newly created container can never be in 'running'
or 'paused' state.
This commit is contained in:
YueGuobin 2026-06-03 22:20:34 +08:00
parent 2adc09604c
commit 4adaba8e8c
No known key found for this signature in database
2 changed files with 707 additions and 740 deletions

View File

@ -588,19 +588,6 @@ class DockerVM(BaseNode):
if self._memory > 0:
log.info(f"Memory limit set to {self._memory} MB")
# Check if the container is already running and update the node status accordingly
# This can happen when the server restarts and the container continues running
try:
state = await self._get_container_state()
if state == "running":
self.status = "started"
log.info(f"Docker container '{self._name}' is already running")
elif state == "paused":
self.status = "suspended"
log.info(f"Docker container '{self._name}' is paused")
except DockerError as e:
log.warning(f"Could not check container state for '{self._name}': {e}")
return True
def _format_env(self, variables, env):

File diff suppressed because it is too large Load Diff