@echo off setlocal enabledelayedexpansion echo === Find and Check Docker Image === echo. echo [INFO] Searching for docker-image.tar files... echo. REM Search for docker-image.tar files in current directory and subdirectories set "FOUND_COUNT=0" for /r %%f in (docker-image.tar) do ( set /a FOUND_COUNT+=1 echo [!FOUND_COUNT!] Found: %%f set "IMAGE_PATH_!FOUND_COUNT!=%%f" ) if %FOUND_COUNT%==0 ( echo [ERROR] No docker-image.tar files found echo Please make sure you have built the Docker package pause exit /b 1 ) echo. echo [INFO] Found %FOUND_COUNT% docker-image.tar file(s) echo. if %FOUND_COUNT%==1 ( set "SELECTED_IMAGE=!IMAGE_PATH_1!" echo [INFO] Using the only found image: !SELECTED_IMAGE! ) else ( echo Please select which image to inspect: for /l %%i in (1,1,%FOUND_COUNT%) do ( echo %%i. !IMAGE_PATH_%%i! ) echo. set /p "CHOICE=Enter your choice (1-%FOUND_COUNT%): " if "!CHOICE!"=="" set "CHOICE=1" if !CHOICE! LSS 1 set "CHOICE=1" if !CHOICE! GTR %FOUND_COUNT% set "CHOICE=1" set "SELECTED_IMAGE=!IMAGE_PATH_%CHOICE%!" echo [INFO] Selected: !SELECTED_IMAGE! ) echo. echo ======================================== echo INSPECTING: !SELECTED_IMAGE! echo ======================================== echo. REM Check file size echo [1] File information: dir "!SELECTED_IMAGE!" echo. REM Load the image echo [2] Loading Docker image... docker load -i "!SELECTED_IMAGE!" if errorlevel 1 ( echo [ERROR] Failed to load image pause exit /b 1 ) echo. echo [3] Checking loaded images: docker images | findstr -v "REPOSITORY" echo. REM Find the image name echo [4] Identifying image... for /f "tokens=1,2" %%a in ('docker images --format "{{.Repository}} {{.Tag}}" 2^>nul') do ( if not "%%a"=="" ( set "IMAGE_NAME=%%a:%%b" echo Found image: %%a:%%b goto :image_found ) ) echo [WARNING] Could not identify image name, using first available for /f "tokens=1,2" %%a in ('docker images --format "{{.Repository}} {{.Tag}}" 2^>nul ^| head -1') do ( set "IMAGE_NAME=%%a:%%b" ) :image_found if "!IMAGE_NAME!"=="" ( echo [ERROR] No valid image found pause exit /b 1 ) echo [INFO] Using image: !IMAGE_NAME! echo. echo [5] Quick file structure check: echo. echo [5a] Root app directory: docker run --rm !IMAGE_NAME! ls -la /app/ 2>nul echo. echo [5b] Checking for fastapi_server.py: docker run --rm !IMAGE_NAME! ls -la /app/fastapi_server.py 2>nul if errorlevel 1 ( echo [ERROR] fastapi_server.py not found! ) else ( echo [SUCCESS] fastapi_server.py found ) echo. echo [5c] Checking for assets directory: docker run --rm !IMAGE_NAME! ls -la /app/assets/ 2>nul if errorlevel 1 ( echo [ERROR] Assets directory not found! echo This is likely the cause of your API parsing error. ) else ( echo [SUCCESS] Assets directory found echo. echo [5d] Assets contents: docker run --rm !IMAGE_NAME! find /app/assets -type f 2>nul ) echo. echo [5e] Checking for domain.json: docker run --rm !IMAGE_NAME! ls -la /app/assets/doc/dms/domain.json 2>nul if errorlevel 1 ( echo [ERROR] domain.json not found! echo This confirms the API parsing error cause. ) else ( echo [SUCCESS] domain.json found echo. echo [5f] Domain.json preview: docker run --rm !IMAGE_NAME! head -5 /app/assets/doc/dms/domain.json 2>nul ) echo. echo [6] Python environment check: docker run --rm !IMAGE_NAME! python3 -c "import sys; print('Python:', sys.version.split()[0]); import os; print('Working dir:', os.getcwd())" 2>nul echo. echo [7] Testing file access from Python: docker run --rm !IMAGE_NAME! python3 -c " import os print('Assets exists:', os.path.exists('/app/assets')) print('Domain.json exists:', os.path.exists('/app/assets/doc/dms/domain.json')) if os.path.exists('/app/assets/doc/dms/domain.json'): try: with open('/app/assets/doc/dms/domain.json', 'r') as f: import json data = json.load(f) print('Domain.json readable: YES') print('Keys count:', len(data)) except Exception as e: print('Domain.json readable: NO -', str(e)) else: print('Domain.json readable: NO - file not found') " 2>nul echo. echo ======================================== echo INSPECTION COMPLETE echo ======================================== echo. echo Summary: echo - Image file: !SELECTED_IMAGE! echo - Image name: !IMAGE_NAME! echo. echo If you see "Assets directory not found" or "domain.json not found" above, echo that explains why your API calls are failing. echo. echo Next steps: echo 1. If assets are missing: Use fix-existing-package.bat echo 2. If assets exist but API still fails: Use quick-fix-container.bat echo. pause