Portainer is a lightweight management UI that allows easy management of Docker environments, including creating, deploying, and managing containers, services, and stacks. It is particularly useful for those who are new to Docker or those who prefer a visual interface over command-line management.
To install Portainer with a persistent container, you can follow these steps:
- Pull the Portainer image: docker pull portainer/portainer
- Create a directory for Portainer data: mkdir -p /mnt/docker/portainer/data
- Create a Docker service for Portainer with the following command:
docker service create \
--name portainer \
--publish 9090:9000 \
--constraint 'node.role == manager' \
--mount type=bind,src=/mnt/docker/portainer/data,dst=/data \
--mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock \
portainer/portainer \
-H unix:///var/run/docker.sock
the above command will create a new Docker service named "portainer" with a published port of 9090, mounted volume for persistent data, and a constraint for the node role of "manager".
- Access the Portainer UI by visiting the IP address or hostname of the Docker swarm manager node on port 9090 in a web browser.
- Create a new user account and start managing your Docker environment using the Portainer UI.
Access the Portainer UI by visiting the IP address or hostname of the Docker swarm manager node on port 9090 in a web browser.