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

无法找到Jetty的root.war,Docker镜像构建问题求助

Fixing the Missing root.war Issue for Jetty Docker Image Build

Hey there! Let's work through this problem step by step. The root.war file you're hunting for isn't in your Brew-installed Jetty because most package managers (like Brew) ship Jetty with just the core runtime, not the sample root web application. The good news is you don't even need that local root.war to build your Docker image—here's how to do it the right way:

Key Insight: Use the Official Jetty Docker Image

Instead of relying on your local Brew-installed Jetty, base your Docker image on the official Jetty container image. It comes pre-configured with everything you need, including the ability to deploy your own WAR file as the root application.

Step 1: Create a Simple Dockerfile

Make a file named Dockerfile in the same directory as your WAR file, with this content:

# Use the exact Jetty version you're targeting (matches your local Brew version)
FROM jetty:9.4.8.v20171121

# Copy your WAR file into Jetty's webapps directory, naming it root.war
# This tells Jetty to deploy your app at the root URL (http://localhost:8080/)
COPY your-app.war /var/lib/jetty/webapps/root.war

Just swap out your-app.war with the actual filename of your WAR file.

Step 2: Build and Run Your Docker Image

Run these commands in your terminal:

# Build the Docker image (tag it as "my-jetty-app" for easy reference)
docker build -t my-jetty-app .

# Start the container, mapping your local port 8080 to the container's 8080
docker run -p 8080:8080 my-jetty-app

Once the container starts up, you can access your application at http://localhost:8080/—no root.war from your local machine required!

If You Really Want a Local root.war (Optional)

If for some reason you need a local copy of root.war (you don't for Docker builds), you can grab it directly from the Jetty distribution archive:

  • Download the Jetty 9.4.8.v20171121 distribution zip from the official Jetty releases
  • Unzip it, and you'll find root.war inside the webapps folder

内容的提问来源于stack exchange,提问作者Paul Cezanne

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.19 09:22:04