Hi, I’m not very experienced with Docker and I am sure I’m missing some key concepts.
I was hoping someone could help point me in the direction of a solution.
I’m running docker with docker compose on linux and had previously had Portainer CE up and running for a year or two. I attempted to update Portainer and was unable to do so. After hitting a brick wall, I gave up a few months back but would now like to try and resolve the issue and reinstall Portainer.
I’m following the directions here: https://docs.portainer.io/start/install-ce/server/docker/linux
The command I am attempting to execute is:
docker run -d -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest
The output I receive is: “docker: Error response from daemon: Address already in use.”
I’ve checked and port 9443 is not being utilized by any processes.
I have removed the previous container and recreated the volume.
I really don’t understand what this response means.
I’m considering it may be related to some leftover data associated with the docker.sock socket from the previous installation, but I don’t really know how to go about investigating this.
I’ve been unsuccessful searching for similar problems.
I originally used “sudo lsof -i:9443” and have since tried meyay’s suggestion of sudo netstat -tlpn | grep 9443. I’m getting no output from either command.
Meyay, maybe I’m being too literal, but it says Address already in use, not port. So maybe there’s an alternate meaning here? Note that I have tried other port numbers that have never been used but still get the same response. This is what led me to believe that it could be related to the socket.
True that “Address” is often used as “IP Address”, but if you check the output of netstat without grep, you will see “Local Address” including the IP and port. Similarly to how your address includes a street name and a house number.
There was another issue as well which involved Docker 26. Have you tried with a different version? v25 for example?
I ran a virtual machine with Docker 26.0.1 preinstalled in it. So I guess there is not much difference compared to 26.0.2 regarding error messages, but when I run a container mapping the same port as another container already mapped, I get a different error message:
docker: Error response from daemon:
driver failed programming external connectivity on endpoint test2 (d37d71085b519757e3ac98b6952e097100325ffde5504df28064d520bcdd5328):
Bind for 0.0.0.0:9443 failed: port is already allocated.
So it indeed should show “port” in the message. If I map a port that is used on the host, not by another container, I get this:
docker: Error response from daemon:
driver failed programming external connectivity on endpoint test3 (e03a8a92f8ce1ff52658f31ef106c9a9fb716f486fb798ca9cbabad980f6fc7c):
Error starting userland proxy: listen tcp4 0.0.0.0:80: bind: address already in use.
So “address already in use is there”, but also more than that. Did you quote the error message exactly as you got it?
I have not tried to downgrade to v25 but it may be a solution. Here’s terminal output trying to run it again. [me@computer ~]$ docker run -d -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest
a34bf682d7bbda4f5571b8a91ac779225eea93309199b59ce1020735693a15ea
docker: Error response from daemon: Address already in use.
So it seems you forgot to mention you use Arch Linux and I forgot to ask. I was curious how you got the version info, but your new output reveals you used pacman which is the package manager on Arch linux.
Here are the supported operating systems:
and Arch is not there. How the package is maintained or how Arch Linux works, I don’t really know.
The difference in the error messages could be because these messages come from the system, but I haven’t checked. Since I don’t know Arch, I can’t tell whether netstat could fail to show some ports or not (but I would be surprised if it could) or what else could cause this issue if not that you actually have something using that port. I could run Portainer on Ubuntu with Docker 26.0.1 and I’m unable to reproduce the issue. I recommend asking about this issue on an Arch forum as well. Maybe the Arch community can suggest something that either solves this issue, or you can come back with new details with the help of the Arch community and share that here hoping we can say something new.
One idea I have is that you can check stopped containers (docker ps -a) and if you have any that you don’t need, delete it. If somehow on Arch even stopped containers cause problems with ports, it could help.
You can also try to run the Docker daemon is verbose mode using the --debug flag. How you need to add it on Arch, I can’t tell. The docker client also has a debug mode, so you can run docker --debug run ... or docker --debug compose .... Of course you need a full and valid command. I only showed the debug flag.
I almost forgot to point out (the obvious) that with or without the debug mode, you should check system logs.