安装Shipyard遇端口占用问题:2375端口被dockerd占用求助
Got it, let's work through this port conflict issue step by step. The problem is straightforward: Shipyard's proxy container tries to bind to port 2375, but your Docker daemon (dockerd) is already using that port for its remote API. Here are three practical solutions to get Shipyard up and running:
Solution 1: Change Shipyard Proxy's Port
The easiest fix is to tell Shipyard to use an unused port instead of 2375. You can do this either by editing the deployment script or passing an environment variable on the fly:
- Modify the
deploy.shscript:
Open the script in your favorite editor, look for lines definingSHIPYARD_PROXY_PORTor hardcoding2375. Change the port to something unused (like 2376):
Save the file and re-run the deployment:# Example line in deploy.sh, update the default port value SHIPYARD_PROXY_PORT=${SHIPYARD_PROXY_PORT:-2376}./deploy.sh - Or set the variable temporarily:
No need to edit the script—just pass the port when running it:SHIPYARD_PROXY_PORT=2376 ./deploy.sh
Solution 2: Reconfigure dockerd to Listen on a Different Port
If you need to keep using Docker's remote API but on another port, adjust dockerd's configuration:
- Edit Docker's daemon config file (usually
/etc/docker/daemon.json). Create it if it doesn't exist:sudo nano /etc/docker/daemon.json - Add or update the
hostsentry to use a new port (e.g., 2376):{ "hosts": ["unix:///var/run/docker.sock", "tcp://0.0.0.0:2376"] }Note: If you're using systemd to manage Docker, check for any
-Hflags in the systemd service file (like/lib/systemd/system/docker.service) and remove them—they'll conflict with the daemon.json settings. - Restart Docker to apply changes:
sudo systemctl daemon-reload sudo systemctl restart docker - Verify dockerd is now listening on the new port:
netstat -ntple | grep dockerd
Once confirmed, run Shipyard's deploy.sh again.
Solution 3: Disable dockerd's Remote API Listener (If Unneeded)
If you don't need to access Docker's API remotely (only using the local Unix socket), turn off the TCP listener entirely:
- Edit
/etc/docker/daemon.jsonand sethoststo only use the Unix socket:{ "hosts": ["unix:///var/run/docker.sock"] } - Restart Docker:
sudo systemctl daemon-reload sudo systemctl restart docker - Check that port 2375 is no longer in use:
netstat -ntple | grep 2375
Then run ./deploy.sh as you originally intended.
After applying any of these fixes, verify Shipyard starts correctly by checking the running containers:
docker ps
You should see the shipyard-proxy container running without port conflict errors.
内容的提问来源于stack exchange,提问作者Lily

