EC2实例运行自定义JIRA容器遇浏览器无法访问问题咨询
Hey there, let's work through why your Jira container isn't accessible even though it shows as running. I've dealt with similar port mapping and connectivity hiccups on EC2 before, so here are the steps to diagnose and fix this:
1. Verify the Jira Container's Actual Listening Port
First up, let's confirm which port Jira is actually using inside the container. Looking at your docker ps output, the container exposes 8080/tcp (the default port for most Jira distributions) alongside your mapped 11111 port. It’s likely this third-party ivantichy/jira:7.9.0 image still relies on 8080 internally instead of 11111.
Check the container logs to find the port Jira binds to:
docker logs jiraKeep an eye out for lines like "Jira starting on port 8080" or similar confirmation.
Alternatively, list active ports inside the container directly:
docker exec jira netstat -tulpn
2. Fix Port Mapping Mismatch
If Jira is indeed using 8080 internally, your initial port mapping was off. You’ll need to restart the container with the correct mapping:
- Stop and remove the existing container:
docker stop jira && docker rm jira - Launch the container with the right port forwarding (send EC2's 11111 traffic to the container's 8080):
docker run -d --name jira -p 11111:8080 ivantichy/jira:7.9.0
3. Double-Check Ubuntu's Built-in Firewall (UFW)
Even if your EC2 security group allows 11111 traffic, Ubuntu's UFW firewall might be blocking it.
- Check UFW’s current rules:
sudo ufw status - If 11111/tcp isn’t listed as allowed, add the rule:
sudo ufw allow 11111/tcp
4. Test Connectivity Directly
- From your local machine, test if the port is reachable:
curl http://<your-ec2-public-ip>:11111 # Or use telnet for a quick connectivity check telnet <your-ec2-public-ip> 11111- If this fails: Double-check your EC2 security group (ensure the inbound rule allows your local IP or
0.0.0.0/0for testing, and the port is set to11111/tcp). - If this works but the browser won’t load: Check the container logs for Jira startup errors—common issues include database connection failures, missing file permissions, or incomplete initialization.
- If this fails: Double-check your EC2 security group (ensure the inbound rule allows your local IP or
5. Validate the Service Inside the Container
If the port seems reachable but Jira isn’t responding, confirm the service is running properly inside the container:
- Enter the container’s shell:
docker exec -it jira bash - Test local access to Jira using the port you confirmed earlier:
If this returns a response, the issue is with external connectivity or port mapping. If not, Jira failed to start inside the container—dig into the logs for specific error messages to resolve the root cause.curl localhost:8080
内容的提问来源于stack exchange,提问作者smart

