[PR #1542] [CLOSED] [WIP] Fix API call failures in Nginx-UI logs #8463

Closed
opened 2026-03-12 23:56:50 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/0xJacky/nginx-ui/pull/1542
Author: @Copilot
Created: 2/6/2026
Status: Closed

Base: devHead: copilot/fix-nginx-ui-api-errors


📝 Commits (3)

  • f98547f Initial plan
  • 2c17656 Fix Docker API compatibility by using explicit version 1.41
  • 337f5f9 Improve maintainability by using constant for Docker API version

📊 Changes

1 file changed (+10 additions, -2 deletions)

View changed files

📝 internal/docker/docker.go (+10 -2)

📄 Description

Docker API Compatibility Fix

This PR addresses the Docker API compatibility issue where ContainerStatPath fails with 404 error.

Analysis Complete

  • Understand the issue: Docker API version negotiation selecting incompatible version (v1.51)
  • Identify root cause: WithAPIVersionNegotiation() doesn't guarantee endpoint compatibility
  • Current Docker SDK version: v28.5.2+incompatible (already latest)

Implementation Complete

  • Update internal/docker/docker.go to use explicit API version (1.41)
  • Extract API version into a named constant for maintainability
  • Build the project successfully
  • Verify no compilation errors
  • Code review completed and feedback addressed

Changes Made

  • Changed Docker client initialization from client.WithAPIVersionNegotiation() to client.WithVersion(dockerAPIVersion)
  • Added constant dockerAPIVersion = "1.41" for easy maintenance
  • API version 1.41 is stable and ensures the /archive endpoint (used by ContainerStatPath) is available
  • This prevents the 404 errors when controlling Nginx in another Docker container

Next Steps

  • Run security checks with CodeQL
Original prompt

This section details on the original issue you should resolve

<issue_title>Controlling Nginx in another Docker Container from Nginx-UI running in a Container, failed API calls</issue_title>
<issue_description>Describe the bug
When using the ContainerName feature to control Nginx in another Container, I see the following error message in the Nginx-UI logs:

nginxui-1  | 2026-02-01 13:45:30.235    ERROR   docker/stat_path.go:24  Failed to stat path error request returned 404 Not Found for API route and version http://%2Fvar%2Frun%2Fdocker.sock/v1.51/containers/nginx/archive?path=%2Frun%2Fnginx.pid, check if the server supports the requested API version

My docker-compose.yml includes the

To Reproduce
Steps to reproduce the behavior:

  1. Start Nginx-UI via Compose:
services:
  nginxui:
    image: 'uozi/nginx-ui:latest'
    restart: unless-stopped

    ports:
      # These ports are in format <host-port>:<container-port>
      #- '80:80' # Public HTTP Port
      #- '443:443' # Public HTTPS Port
      - '9000:9000' # UI?

    environment:
      TZ: "Europe/Berlin"
      #NGINX_UI_IGNORE_DOCKER_SOCKET: true
      NGINX_UI_SERVER_PORT: 9000
      NGINX_UI_SERVER_RUN_MODE: release
      NGINX_UI_NGINX_CONTAINER_NAME: nginx

    volumes:
      - ./appdata/nginx:/etc/nginx
      - ./appdata/nginx-logs:/var/log/nginx
      - ./appdata/nginx-ui:/etc/nginx-ui
      - ./var/www:/var/www
      - /var/run/docker.sock:/var/run/docker.sock
  1. Start a Nginx Container via Compose, for example like this:
services:
  nginx:
    image: nginxinc/nginx-unprivileged:latest
    container_name: nginx
    ports:
      - "8080:8080"
    volumes:
      # Main nginx config
      - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
      # Site configs
      - ./nginx/conf.d:/etc/nginx/conf.d:ro
      # Optional: logs on host
      - ./nginx/logs:/var/log/nginx
    restart: unless-stopped
  1. Log in to Nginx-UI, go to Nginx and you see the message Get data failed, Nginx is not running

Expected behavior
I would expect to see a connection to the Nginx Container.

Info (please complete the following information):

  • Server OS: Ubuntu Server 24.04 LTS
  • Server Arch: amd64
  • Nginx UI Version: 2.3.2
  • Your Browser: Edge, Chrome and Vivaldi

Additional context
According to the Documentation I got the impression that the only thing I need to do are including the Docker Socket in the Stack and tell Nginx-UI either in the compose file or in the app.ini the name of the nginx Container.
I suspected, that this is an issue with the Docker API version, which recently bumped up their minimum version, which caused issues with other software as well. So I went ahead and lowered the minimum API version of my Docker installation to 1.24, but this did not help.
</issue_description>

Comments on the Issue (you are @copilot in this section)

@0xJacky Thank you for your feedback. We will update the version of the Docker client to be compatible with the new version of the API.

Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/0xJacky/nginx-ui/pull/1542 **Author:** [@Copilot](https://github.com/apps/copilot-swe-agent) **Created:** 2/6/2026 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `copilot/fix-nginx-ui-api-errors` --- ### 📝 Commits (3) - [`f98547f`](https://github.com/0xJacky/nginx-ui/commit/f98547fe341eccdbf98808d5a47db39449950572) Initial plan - [`2c17656`](https://github.com/0xJacky/nginx-ui/commit/2c17656eb312d48df1ecb0b42edee69f6bd8f010) Fix Docker API compatibility by using explicit version 1.41 - [`337f5f9`](https://github.com/0xJacky/nginx-ui/commit/337f5f95d08c8c76e01c9d44b5191f5bbbad8631) Improve maintainability by using constant for Docker API version ### 📊 Changes **1 file changed** (+10 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `internal/docker/docker.go` (+10 -2) </details> ### 📄 Description ## Docker API Compatibility Fix This PR addresses the Docker API compatibility issue where `ContainerStatPath` fails with 404 error. ### Analysis Complete - [x] Understand the issue: Docker API version negotiation selecting incompatible version (v1.51) - [x] Identify root cause: `WithAPIVersionNegotiation()` doesn't guarantee endpoint compatibility - [x] Current Docker SDK version: v28.5.2+incompatible (already latest) ### Implementation Complete - [x] Update `internal/docker/docker.go` to use explicit API version (1.41) - [x] Extract API version into a named constant for maintainability - [x] Build the project successfully - [x] Verify no compilation errors - [x] Code review completed and feedback addressed ### Changes Made - Changed Docker client initialization from `client.WithAPIVersionNegotiation()` to `client.WithVersion(dockerAPIVersion)` - Added constant `dockerAPIVersion = "1.41"` for easy maintenance - API version 1.41 is stable and ensures the `/archive` endpoint (used by ContainerStatPath) is available - This prevents the 404 errors when controlling Nginx in another Docker container ### Next Steps - [ ] Run security checks with CodeQL <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> > > ---- > > *This section details on the original issue you should resolve* > > <issue_title>Controlling Nginx in another Docker Container from Nginx-UI running in a Container, failed API calls</issue_title> > <issue_description>**Describe the bug** > When using the ContainerName feature to control Nginx in another Container, I see the following error message in the Nginx-UI logs: > > ``` > nginxui-1 | 2026-02-01 13:45:30.235 ERROR docker/stat_path.go:24 Failed to stat path error request returned 404 Not Found for API route and version http://%2Fvar%2Frun%2Fdocker.sock/v1.51/containers/nginx/archive?path=%2Frun%2Fnginx.pid, check if the server supports the requested API version > ``` > > My docker-compose.yml includes the > > > **To Reproduce** > Steps to reproduce the behavior: > 1. Start Nginx-UI via Compose: > ```yaml > services: > nginxui: > image: 'uozi/nginx-ui:latest' > restart: unless-stopped > > ports: > # These ports are in format <host-port>:<container-port> > #- '80:80' # Public HTTP Port > #- '443:443' # Public HTTPS Port > - '9000:9000' # UI? > > environment: > TZ: "Europe/Berlin" > #NGINX_UI_IGNORE_DOCKER_SOCKET: true > NGINX_UI_SERVER_PORT: 9000 > NGINX_UI_SERVER_RUN_MODE: release > NGINX_UI_NGINX_CONTAINER_NAME: nginx > > volumes: > - ./appdata/nginx:/etc/nginx > - ./appdata/nginx-logs:/var/log/nginx > - ./appdata/nginx-ui:/etc/nginx-ui > - ./var/www:/var/www > - /var/run/docker.sock:/var/run/docker.sock > ``` > 2. Start a Nginx Container via Compose, for example like this: > ```yaml > services: > nginx: > image: nginxinc/nginx-unprivileged:latest > container_name: nginx > ports: > - "8080:8080" > volumes: > # Main nginx config > - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro > # Site configs > - ./nginx/conf.d:/etc/nginx/conf.d:ro > # Optional: logs on host > - ./nginx/logs:/var/log/nginx > restart: unless-stopped > ``` > 3. Log in to Nginx-UI, go to Nginx and you see the message `Get data failed, Nginx is not running` > > **Expected behavior** > I would expect to see a connection to the Nginx Container. > > **Info (please complete the following information):** > - Server OS: Ubuntu Server 24.04 LTS > - Server Arch: amd64 > - Nginx UI Version: 2.3.2 > - Your Browser: Edge, Chrome and Vivaldi > > **Additional context** > According to [the Documentation](https://nginxui.com/guide/config-nginx.html) I got the impression that the only thing I need to do are including the Docker Socket in the Stack and tell Nginx-UI either in the compose file or in the app.ini the name of the nginx Container. > I suspected, that this is an issue with the Docker API version, which recently bumped up their minimum version, which caused issues with other software as well. So I went ahead and lowered the minimum API version of my Docker installation to 1.24, but this did not help. > </issue_description> > > ## Comments on the Issue (you are @copilot in this section) > > <comments> > <comment_new><author>@0xJacky</author><body> > Thank you for your feedback. We will update the version of the Docker client to be compatible with the new version of the API.</body></comment_new> > </comments> > </details> <!-- START COPILOT CODING AGENT SUFFIX --> - Fixes 0xJacky/nginx-ui#1536 <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/0xJacky/nginx-ui/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-12 23:56:50 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nginx-ui#8463
No description provided.