mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-04 06:21:15 +02:00
Adds controller and compute API support for explicitly pulling or updating Docker images.
This commit is contained in:
1 parent
28f883b46a
commit
2abc7e09a3
6 files changed
+229
-32
No files matched your search
@@ -21,7 +21,7 @@ API routes for images.
|
||||
import os
|
||||
import urllib.parse
|
||||
|
||||
from fastapi import APIRouter, Request, status, Response, HTTPException
|
||||
from fastapi import APIRouter, Body, Request, status, Response, HTTPException
|
||||
from fastapi.responses import FileResponse
|
||||
from typing import List
|
||||
|
||||
@@ -43,6 +43,16 @@ async def get_docker_images() -> List[dict]:
|
||||
return await docker_manager.list_images()
|
||||
|
||||
|
||||
@router.post("/docker/images/pull", status_code=status.HTTP_204_NO_CONTENT)
|
||||
async def pull_docker_image(image: str = Body(..., embed=True, min_length=1, pattern=r"^\S+$")) -> None:
|
||||
"""
|
||||
Pull or update a Docker image.
|
||||
"""
|
||||
|
||||
docker_manager = Docker.instance()
|
||||
await docker_manager.pull_image(image, force=True)
|
||||
|
||||
|
||||
@router.get("/dynamips/images")
|
||||
async def get_dynamips_images() -> List[dict]:
|
||||
"""
|
||||
|
||||
Reference in new issue
Block a user