DEV Community

Akbar Nafisa
Akbar Nafisa

Posted on

Setup Portainer for Server App

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.

Image description

Image description

Next, create a new Docker volume for Portainer:



docker volume create portainer_data


Enter fullscreen mode Exit fullscreen mode

Image description

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


Enter fullscreen mode Exit fullscreen mode

Image description

Then, verify if the container is running.

Image description

Open Port for Portainer

Portainer is running on port 9443, so we need to add new port inside our security groups.

Image description

Image description

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.

Image description

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.

Image description

Then, in Portainer page, we need to add username and password.

Image description

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.

Image description

Image description

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.

Image description

Top comments (0)