Backport from v3: install Docker resources in a writable location at runtime.

This commit is contained in:
grossmj committed 2024-02-14 16:13:45 +08:00
1 parent 1f5085608c
commit 1a53c9aabf
6 files changed
+142 -48

No files matched your search

+9 -4
View File
@@ -242,10 +242,13 @@ class DockerVM(BaseNode):
:returns: Return the path that we need to map to local folders
"""
resources = get_resource("compute/docker/resources")
if not os.path.exists(resources):
raise DockerError("{} is missing can't start Docker containers".format(resources))
binds = ["{}:/gns3:ro".format(resources)]
try:
resources_path = self.manager.resources_path()
except OSError as e:
raise DockerError(f"Cannot access resources: {e}")
log.info(f'Mount resources from "{resources_path}"')
binds = ["{}:/gns3:ro".format(resources_path)]
# We mount our own etc/network
try:
@@ -460,6 +463,8 @@ class DockerVM(BaseNode):
Starts this Docker container.
"""
await self.manager.install_resources()
try:
state = await self._get_container_state()
except DockerHttp404Error: