itzg / itzg/docker-minecraft-server

Option to keep container alive after server stop (Process Supervisor)

Open
#3,795 4 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Shell
Stars
14.3k
Forks
1.9k
Avg merge
2d 10h
Merged PRs (30d)
31

Description

### Enhancement Type

A completely new feature

### Describe the enhancement

## Description:

Hi there! Thanks for maintaining this awesome image.

I’m currently building a custom Admin UI for my server that runs as a sidecar container alongside the Minecraft container. One of the main features I'm adding is a "Maintenance Mode" that allows me to stop the server process to modify config files and swap out mods (which requires the server to be stopped in most cases).

## The Problem

Currently, when I stop the Minecraft server process (even gracefully), the container entrypoint exits, which kills the container. In my setup (Kubernetes), this restarts the entire Pod, which unfortunately kills my Admin UI sidecar right in the middle of the maintenance workflow.

### Why existing solutions don't fit

I already considered just letting the container die and having my application trigger a restart externally (like calling the Kubernetes API to restart the Deployment). However, I decided against this because:
- Platform Coupling: It would force my app to know about the underlying infrastructure (K8s, Docker Swarm, plain Docker Compose).
- Complexity: I want my Admin UI to be platform-agnostic and "just work" with this container standard, without needing permission to talk to the cluster API or host daemon.

## Request
First off, I absolutely love that we can already control the health check by modifying the mc-health.env file. That feature is amazing and is the first step to making my use case possible, as it allows me to tell Kubernetes the pod is "healthy" even when I've intentionally stopped the server for maintenance.

The final missing piece is to keep the container itself from exiting when the java process stops.

So, it would be amazing if there was a flag (e.g., KEEP_ALIVE_ON_STOP=true) or a supervisor mode that keeps the container entrypoint running even if the actual java process stops. This would allow a sidecar or local script to stop the server, do some work, and start it again—all without the container itself ever crashing or restarting.
Is this something that could be added to `mc-server-runner`?

Thanks

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading mc-server-runner and the container entrypoint to understand how the Java process stop currently causes the container to exit. Define the supervisor behavior and configuration flag needed to keep the entrypoint running, allow maintenance work, and support starting the server again without restarting the container.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, java, kubernetes, shell
Domain
devops, infrastructure
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.