Reference · Self-hosted services
Portainer and the Docker socket: ports 9443, 9000 and 8000, the first administrator, and root on the host
A container that mounts /var/run/docker.sock can control Docker and, through it, the host as root. Find those containers, read Portainer's ports 9443, 9000 and 8000, create the first administrator inside the 5-minute window with the setup token, and publish the interface on 127.0.0.1.
| Target artifact | Containers that mount the Docker socket /var/run/docker.sock, and the Portainer server ports 9443 (web interface over HTTPS), 9000 (legacy HTTP) and 8000 (Edge agent tunnel). |
|---|---|
| Default behaviour | Portainer's install command mounts the socket and publishes 9443 and 8000 on every host address; a new server stops if no administrator is created within 5 minutes; from 2.39.4 and 2.43.0, creating it needs a setup token from the server log. |
| Safe state | Portainer 2.45 LTS or a later supported release; on the 2.39 LTS line, which Portainer supports until November 2026, 2.39.4 or later; 9443 published on 127.0.0.1 or a private address; 9000 not published; 8000 published only for Edge agents; no other container mounts the socket unless it must. |
| Check on Linux | docker ps -q | xargs -r docker inspect --format '{{.Name}}{{range .Mounts}} {{.Source}}{{end}}' | grep docker.sock |
| Check on Linux | sudo ss -tlnp | grep -E ':(9443|9000|8000)\b' |
| Check from another device | nc -vz -w 5 SERVER_IP 9443 |
| Fix in Docker | recreate Portainer with -p 127.0.0.1:9443:9443, leaving out -p 9000:9000, and -p 8000:8000 unless Edge agents connect |
| Fix for the version | docker pull portainer/portainer-ce:lts, then recreate the container with the same volumes |
Read the result
| Result | Meaning |
|---|---|
/portainer /var/run/docker.sock | That container can send any request to Docker, and through Docker act as root on the host |
127.0.0.1:9443 owned by docker-proxy | Only this computer can reach the interface |
0.0.0.0:9443 or [::]:9443 | The interface is open to every network the host is on, whatever UFW says |
0.0.0.0:8000 owned by docker-proxy | The Edge agent tunnel is open to everyone; Portainer needs it only for Edge agents |
:9000 owned by docker-proxy | The interface is also served over plain HTTP, so sign-ins cross the network unencrypted |
Other programs also use ports 8000 and 9000; the last column of ss names the owner. On Ubuntu, /var/run is a link to /run, so a container can also mount the socket as /run/docker.sock. The first check finds both.
Why the socket is root on the host
The Docker daemon runs as root and takes its orders through /var/run/docker.sock. Docker's security documentation says only trusted users should control the daemon, and gives the example of a container started with the host's / directory as /host: that container "can alter your host filesystem without any restriction". Docker's post-installation guide says the same of the docker group, which grants access to the socket: it "grants root-level privileges to the user".
Mounting the socket into a container hands that control to the container and to anyone who controls it. Portainer mounts it to manage Docker, so whoever holds Portainer's administrator account can make the same requests.
A read-only mount does not change this. In a test with Docker Engine 29.9.2, a container started with -v /var/run/docker.sock:/var/run/docker.sock:ro still started a new container with the host's / mounted, and that container read the host's /etc/shadow as root. The :ro flag makes the mount read-only; it does not limit what the Docker API accepts.
The first-administrator window
A new Portainer server waits for someone to create its administrator account. If nobody does within 5 minutes of start-up, Portainer stops and logs that the instance "timed out for security purposes"; restarting it gives another 5 minutes. Portainer's documentation says this keeps someone else from taking over a fresh installation.
Portainer's advisory for CVE-2026-55761, published on 2 July 2026, says the administrator-initialization and restore endpoints stayed open to unauthenticated requests during the window, so anyone who reached the port could create the first administrator or restore a crafted backup. It lists 2.39.0 to 2.39.3, and 2.40.0 and later versions before 2.43.0, as affected, and says the open path has been there since the backup and restore feature was introduced: releases before 2.39.0, the 2.33 LTS line included, are end-of-life and will not get a fix. Portainer 2.39.4 and 2.43.0 fix it with a one-time setup token: a new server writes the token to its log, and setup is refused without it.
- Publish
9443on127.0.0.1before the first start, as in Publish the interface. - Read the token on the server:
docker logs portainer 2>&1 | grep setup_token=- From your laptop, open a tunnel, then create the administrator at
https://127.0.0.1:9443within 5 minutes:
ssh -N -L 9443:127.0.0.1:9443 USER@SERVERPortainer's certificate is self-signed by default, so the browser warns about it.
Set the administrator password at start-up instead
Portainer's --admin-password-file flag reads the password from a file in plain text, and --admin-password takes a bcrypt hash and works only when the administrator is first created. With either flag, Portainer generates no setup token. Its documentation suggests this for managed installs where you cannot read the log.
The --no-setup-token flag
It turns the token off. Portainer's documentation says to use it only on a network you fully control and trust, such as an air-gapped one.
Publish the interface on 127.0.0.1 or a private address
Portainer's install command publishes -p 8000:8000 -p 9443:9443. Docker's documentation calls publishing insecure by default, because a published port is available to the outside world, and Docker routes that traffic before UFW's rules apply: see Docker published ports bypass UFW.
Change the publish address rather than Portainer's --bind-https flag, which sets the address inside the container: in a test, a server listening on 127.0.0.1 inside its container could not be reached through its published port.
docker run
docker stop portainer && docker rm portainer
docker run -d -p 127.0.0.1:9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:ltsRemoving the container keeps the portainer_data volume, which holds Portainer's database. Add -p 8000:8000 back only if Edge agents connect to this server.
Docker Compose
ports:
- "127.0.0.1:9443:9443"Then run docker compose up -d in the same folder to recreate the container.
A private address, such as WireGuard or Tailscale
Publish on that address instead: -p PRIVATE_IP:9443:9443. Docker binds the address when the container starts: in a test with Docker Engine 29.9.2, an address the host did not have yet failed with failed to bind host port ... cannot assign requested address, and the container stayed in the Created state. WireGuard and Tailscale binding covers the start-up order.
Ports 9443, 9000 and 8000
- 9443 serves the web interface over HTTPS, with a self-signed certificate unless you supply your own.
- 9000 is legacy HTTP. Portainer's install command does not publish it; its documentation says to add
-p 9000:9000only if you need it open for legacy reasons. Over HTTP, passwords and session cookies are not encrypted. - 8000 is a TCP tunnel server for Edge agents. Portainer's documentation calls it optional and needed only for Edge compute features. If you use them, the agents must be able to reach it.
Troubleshooting
"Your Portainer instance has timed out for security purposes"
Nobody created the administrator within 5 minutes. Run docker stop portainer and docker start portainer, then finish the setup within the next 5 minutes. If this happens on an installation that worked before, check that the portainer_data volume is mounted: without it, Portainer treats the server as new.
The setup page refuses the token
The token is missing or wrong. Read it again from the log with the command above, and paste only the value after setup_token=.
Related guides and lookups
Sources
- Portainer: install Portainer CE with Docker on Linux, ports and volumes
- Portainer: setup token FAQ
- Portainer: "Your Portainer instance has timed out for security purposes"
- Portainer: CLI configuration options
- Portainer: upgrade on Docker standalone
- Portainer: lifecycle policy
- CVE record: CVE-2026-55761
- Portainer security advisory GHSA-x626-fcwx-f5pc
- Docker: Docker Engine security, the daemon attack surface
- Docker: Linux post-installation steps, the docker group
- Docker: port publishing
- Docker: packet filtering and firewalls, Docker and ufw