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

谷歌云Ubuntu虚拟机中Docker BusyBox容器无法外部IP访问

Troubleshooting Access to Your BusyBox Containers

Let’s break down why you’re hitting that "site unreachable" error and fix it step by step:

The Root Problem: BusyBox Doesn’t Run a Web Service by Default

When you start a BusyBox container with just the sh command, it only spins up a shell session—there’s no web server listening on port 8080 (the container port you mapped to your host’s ports). That’s why your external URLs aren’t working.

Step 1: Confirm No Service is Listening in the Container

First, verify there’s nothing running on port 8080 inside your containers. Run this for each container (swap bb1 with tt3 for the other one):

docker exec -it bb1 netstat -tulpn

If netstat isn’t available, use BusyBox’s built-in tool:

docker exec -it bb1 ss -tulpn

You’ll almost certainly see no entries for port 8080—proof no service is active there.

Step 2: Start a Simple Web Service in the Container

BusyBox includes a tiny built-in web server called httpd. Let’s get it running:

  1. Jump into the container shell:
    docker exec -it bb1 sh
    
  2. Create a test HTML file so you have something to view:
    echo "<h1>Hello from BusyBox!</h1>" > /tmp/index.html
    
  3. Launch the web server on port 8080, using /tmp as the web root:
    httpd -p 8080 -h /tmp
    
  4. Exit the shell with Ctrl+D.

Repeat these steps for your tt3 container too.

Step 3: Test Locally First

Before trying your external IP, test from your host machine to rule out port mapping issues:

  • For bb1: curl http://localhost:32769
  • For tt3: curl http://localhost:80
    If you see your test HTML content, the container service and port mapping are working correctly.

Step 4: Fix External Access Blockages

If local access works but external access fails:

  • Check your host firewall: Make sure tools like ufw (Ubuntu) or iptables allow incoming traffic on ports 80 and 32769.
  • Check cloud security groups: If you’re using a cloud server (like Google Cloud), confirm your instance’s security group has rules permitting inbound traffic on those ports (allow your external IP specifically, or 0.0.0.0/0 for testing).

Pro Tip: Start the Web Service Automatically

Avoid manually starting httpd every time by launching the container with the web server command directly:

docker run -d -p 80:8080 --name tt3 busybox httpd -p 8080 -h /tmp

This way, the web server boots up as soon as the container starts.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.27 04:08:20