You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何上传Docker镜像至GitHub?如何自定义Kibana镜像并存入VSTS/Git?

Customizing Kibana Docker Image & Managing Storage in VSTS/Git + GitHub Container Registry

Let's break down your problem into actionable, straightforward steps to cover both your custom image needs and repository uploads.

First: Fix the Port Mismatch & Create a Custom Kibana Image

You can’t store full Docker images directly in Git/VSTS (they’re too large), but you can store a Dockerfile that builds your customized image from the official base. This way, you control the configuration and avoid pulling the unmodified latest image every time.

1. Write a Custom Dockerfile

Create a file named Dockerfile in your project directory with one of these options:

Option A: Use Environment Variables (Recommended)

This keeps your config flexible without editing files directly:

# Start with a specific Kibana version (pinning avoids unexpected updates)
FROM kibana:8.11.3

# Set Kibana to listen on port 9201
ENV SERVER_PORT=9201

Option B: Modify the Kibana Config File

If you prefer editing the config directly:

FROM kibana:8.11.3

# Append the port setting to Kibana's core config file
RUN echo "server.port: 9201" >> /usr/share/kibana/config/kibana.yml

2. Store the Dockerfile in VSTS/Git

Commit this Dockerfile to your VSTS (Azure DevOps) or Git repository. This acts as your source of truth for the custom image—you can tweak it anytime and rebuild the image as needed.

3. Build & Host the Image in VSTS

Azure DevOps integrates seamlessly with Azure Container Registry (ACR) to host your custom images:

  • Create an Azure Container Registry (ACR) if you don’t have one already.
  • Set up a CI pipeline in Azure DevOps that:
    1. Pulls the Dockerfile from your Git repo.
    2. Runs docker build -t your-acr-name.azurecr.io/custom-kibana:latest . to build the image.
    3. Pushes the built image to your ACR using docker push your-acr-name.azurecr.io/custom-kibana:latest.

Update your docker-compose.yml to use this custom image:

kibana:
  image: your-acr-name.azurecr.io/custom-kibana:latest
  links:
    - "elasticsearch"
  ports:
    - "9201:9201"
  networks:
    - cloud

Second: Upload Your Docker Image to GitHub

GitHub offers the GitHub Container Registry (GHCR) to host Docker images. Here’s how to use it:

1. Prepare a GitHub Personal Access Token (PAT)

  • Go to your GitHub Settings → Developer Settings → Personal Access Tokens.
  • Generate a token with the write:packages and read:packages permissions (this lets you push and pull images).

2. Log In to GHCR Locally

Run this command in your terminal (replace placeholders with your details):

echo YOUR_GITHUB_PAT | docker login ghcr.io -u YOUR_GITHUB_USERNAME --password-stdin

3. Tag Your Image for GHCR

Tag your built custom image with the required GHCR format:

docker tag custom-kibana:latest ghcr.io/YOUR_GITHUB_USERNAME/YOUR_REPO_NAME/custom-kibana:latest

Example: ghcr.io/ananddeshmukh/kibana-config/custom-kibana:latest

4. Push the Image to GHCR

docker push ghcr.io/YOUR_GITHUB_USERNAME/YOUR_REPO_NAME/custom-kibana:latest

You can now use this image in your docker-compose.yml like so:

kibana:
  image: ghcr.io/YOUR_GITHUB_USERNAME/YOUR_REPO_NAME/custom-kibana:latest
  links:
    - "elasticsearch"
  ports:
    - "9201:9201"
  networks:
    - cloud

Quick Alternative: Avoid Custom Images Altogether

If you only need to fix the port issue and don’t need other customizations, you can skip building a custom image entirely:

  1. Pin the Kibana image to a specific version (instead of latest) to prevent unexpected updates.
  2. Map your host port 9201 to the container’s default 5601 port:
kibana:
  image: kibana:8.11.3
  links:
    - "elasticsearch"
  ports:
    - "9201:5601"
  networks:
    - cloud

内容的提问来源于stack exchange,提问作者Anand Deshmukh

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 08:39:46