Files
docs/Servers/Containerization/Docker/Deploy Portainer.md

2.1 KiB

Update The Package Manager

We need to update the server before installing Docker

=== "Ubuntu Server"

``` sh
sudo apt update
sudo apt upgrade -y
```

=== "Rocky Linux"

``` sh
sudo dnf check-update
```

Deploy Docker

Install Docker then deploy Portainer

Convenience Script:

curl -fsSL https://get.docker.com | sudo sh

Alternative Methods:

=== "Ubuntu Server"

``` sh
sudo apt install docker.io -y
docker run -d -p 8000:8000 -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v /srv/containers/portainer:/data portainer/portainer-ee:latest # (1)
```

1.  Be sure to set the `-v /srv/containers/portainer:/data` value to a safe place that gets backed up regularily.

=== "Rocky Linux"

``` sh
sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo dnf install docker-ce docker-ce-cli containerd.io
sudo systemctl start docker
sudo systemctl enable docker # (1)
docker run -d -p 8000:8000 -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v /srv/containers/portainer:/data portainer/portainer-ee:latest # (2)
```

1.  This is needed to ensure that docker starts automatically every time the server is turned on.
2.  Be sure to set the `-v /srv/containers/portainer:/data` value to a safe place that gets backed up regularily.

Configure Docker Network

I highly recomment setting up a Dedicated Docker MACVLAN Network. You can use it to keep your containers on their own subnet.

Access Portainer WebUI

You will be able to access the Portainer WebUI at the following address: https://<IP Address>:9443 !!! warning You need to be quick, as there is a timeout period where you wont be able to onboard / provision Portainer and will be forced to restart it's container. If this happens, you can find the container using sudo docker container ls proceeded by sudo docker restart <ID of Portainer Container>.