Deployment Overview of Portainer on Server¶
Prerequisites and Basic Requirements¶
The server must meet the following requirements before deployment:
-
Operating System: Debian, Ubuntu, CentOS, or RHEL-based distributions.
-
Privileges: Root access or equivalent
sudoprivileges are required. -
Network Connectivity: Access to the internet is required to download packages and container images.
-
Domain: The deployment utilizes the
hostkey.indomain zone. -
Ports: Port
9000must be available and open on the server firewall.
FQDN of the Final Panel¶
The application is accessible via the following Fully Qualified Domain Name (FQDN) format:
-
docker<Server ID>.hostkey.in:9000 -
Note: The
<Server ID>placeholder represents the specific identifier assigned to your server instance. The prefix is fixed asdocker.
File and Directory Structure¶
The following directories and files are utilized by the deployment:
-
Docker Daemon Configuration:
/etc/docker/daemon.json -
Docker Socket:
/var/run/docker.sock -
Container Data: Managed within the Docker container filesystem (Portainer data is persisted via the Docker engine's volume management, though the provided configuration mounts the socket for management).
Application Installation Process¶
The deployment process involves the installation of the Docker Engine followed by the immediate deployment of the Portainer container. The steps below describe the final state achieved:
-
Package Updates: System packages are updated and upgraded to the latest versions.
-
Docker Engine Installation: The Docker Engine (Community Edition) is installed using the distribution-specific package manager.
-
Docker SDK for Python: The
python3-dockerordockerSDK is installed to manage containers via scripts. -
Docker Configuration: A custom
daemon.jsonfile is deployed to/etc/docker/. -
Service Activation: The Docker service is enabled to start on boot and started immediately.
-
Container Deployment: The Portainer CE container is pulled from the registry and started with the specified configuration.
Docker Containers and Their Deployment¶
The application runs as a single Docker container with the following configuration parameters:
| Parameter | Value | Description |
|---|---|---|
| Container Name | portainer | The internal identifier for the container. |
| Image | portainer/portainer-ce | The official Portainer Community Edition image. |
| Restart Policy | always | Ensures the container restarts automatically after failure or reboot. |
| Host Port Mapping | 9000:9000 | Maps host port 9000 to container port 9000. |
| Volume Mount | /var/run/docker.sock:/var/run/docker.sock | Grants the container control over the host's Docker Engine. |
| Image Pull | yes | Ensures the latest version of the image is downloaded before starting. |
Access Rights and Security¶
-
Firewall: Port
9000must be accessible. Ensure the server's firewall (e.g.,ufw,firewalld) allows incoming TCP connections on this port. -
Docker Socket Access: The container has direct access to the host's Docker socket (
/var/run/docker.sock), allowing it to manage all containers and Docker resources on the host. -
User Privileges: The installation requires root-level privileges to configure the Docker daemon and mount the socket.
Starting, Stopping, and Updating¶
Once deployed, the Docker service and the Portainer container are managed using standard Docker commands:
-
Start the Docker Service:
-
Enable Docker on Boot:
-
Restart the Portainer Container:
-
Stop the Portainer Container:
-
Update the Portainer Image and Restart: To update, pull the latest image and restart the container:
Location of Configuration Files and Data¶
-
Docker Daemon Configuration: The daemon configuration is stored at
/etc/docker/daemon.json. -
Portainer Data: Portainer stores its database and configuration within the Docker container's writable layer. Since the configuration provided does not define a separate persistent volume for the Portainer data directory, the data resides within the container's filesystem. Re-running the installation may result in data loss if the container is removed before this configuration is adjusted to include a persistent volume mount for the data path.
Available Ports for Connection¶
- Port 9000: The primary HTTP port for accessing the Portainer web interface.