Setup Portainer for Server App
Akbar Nafisa
Posted on January 24, 2024
In this section, we will add Portainer to help us in managing our Docker containers. You can find more details about it here. To integrate Portainer into our EC2 project, we can follow these steps:
Install Portainer Container
First, let’s connect to our EC2 instance.
Next, create a new Docker volume for Portainer:
docker volume create portainer_data
Now, let’s run the Portainer container:
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:latest
Then, verify if the container is running.
Open Port for Portainer
Portainer is running on port 9443
, so we need to add new port inside our security groups.
Let’s select Custom TCP
and set the port range to 9443
, and for the source set to Anywhere-IPv4
, then click Save rules
button to finish the configuration.
Login to Portainer
To log in to Portainer, open the public IP of our EC2 then add 9443
port. If we are connecting for the first time, your browser might block access. Click the Show advanced
button or a similar option depending on your browser, then click the link bellow.
Then, in Portainer page, we need to add username and password.
After you finish the previous process, we can look around inside the dasboard. In Home
section we can click local
environments to see the currently running containers.
When you open the Stacks
page, we can see that we have limited control to our project. For the next part, we will migrate our project inside Portainer so we can manage it easily.
Posted on January 24, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.