
Portainer
Posted under » System Admin on 08 Apr 2025
From docker ..
Portainer needs persisting data (for storing user password for example). Let's create a docker volume to store this data.
$ docker volume create portainer_data
$ docker volume inspect portainer_data
Now run it on port 9000
$ docker run -d -p 8000:8000 -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:2.21.4
Here is the detail of each option:
- docker run is the base command to start a container
- -d means detach. It runs the container in background.
- -p expose UI over the port 9443, portainer GUI will be at URL hostname:9443
- the ip must be valid. Here is mine https://192.168.18.56:9443/ sometimes our port 80 is using another IP from the router.
- --name=portainer names the container portainer
- --restart=always always restart Portainer (after a crash or at machine or deamon restart)
- -v /var/run/docker.sock:/var/run/docker.sock mounts the volume /var/run/docker.sock from the host machine to the Portainer container.
/var/run/docker.sock is actually the Docker daemon socket. Portainer needs this socket to get Docker status.
- -v portainer_data:/data mounts the volume created previously portainer/portainer-ce is the name of the Portainer Community Edition image.
The first time Portainer starts, it asks you to set a password. The password must be at least 12 characters.
Once the password is entered, you are in business.