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

Docker入门教程执行docker run命令遭遇80端口占用错误的解决方案咨询

Troubleshooting "address already in use" for Docker Port 80

Hey there, that error pops up because port 80 on your machine is already being used by another process—not a Docker container (since you already cleared all those with docker rm -fv $(docker ps -aq)). Let's walk through how to fix this:

Step 1: Find out which process is hogging port 80

Use these commands based on your operating system to track down the culprit:

  • Linux/macOS:
    lsof -i :80
    # Or an alternative command
    netstat -tulpn | grep :80
    
    Look for the PID column—this is the unique ID of the process using port 80.
  • Windows:
    netstat -ano | findstr ":80"
    
    The last number in each line is the PID of the process occupying the port.

Step 2: Stop the conflicting process

Once you have the PID, kill the process to free up port 80:

  • Linux/macOS:
    kill -9 <PID_NUMBER>
    
    Replace <PID_NUMBER> with the actual number from Step 1. If it's a system service like Apache or Nginx, you can also stop it directly (e.g., sudo systemctl stop apache2 on Ubuntu-based systems).
  • Windows:
    taskkill /F /PID <PID_NUMBER>
    
    The /F flag forces the process to shut down immediately.

Step 3: Alternative option - Use a different port for Docker

If you don't want to stop the existing process, just map Docker's internal port 80 to a different host port. For example:

docker run -d -p 8080:80 docker/getting-started

Now you can access the getting-started app by visiting localhost:8080 in your browser.


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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.01 00:12:31