In this blog, we will be learning about Docker Portainer and how to deploy a container using it.
What is Docker Portainer?
Portainer is a container management platform. It allows the management of various Docker environments. It helps in managing the containers, networks, volumes, and Swarm services using a web-based dashboard of Portainer. For monitoring docker applications, one can use Portainer.
Firstly, let’s see the installation steps of Portainer.
Installation of Portainer
Prerequisites- Docker version 19.01 or higher, is a prerequisite as this version of Docker supports all the features of Portainer.
After this, follow the steps given below:
Step 1: Run the following command, it will create a volume named ‘portainer_data’ and Portainer will use the same to store configuration data.
docker volume create portainer_data
Step 2: Then run the following command, it will pull an image named ‘portainer/portainer-ce’ and run a new container. The Portainer UI is accessible on port 9000.
docker run -d -p 9000:9000 --name=portainer --restart=unless-stopped -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce
The above image is of the dashboard which shows what services are running on docker currently.
Deploying a docker container using Portainer
Now, we’ll go through the steps for deploying the Nginx web server through the Portainer dashboard.
Step 1: For creating a new container, enter a name for the container. Then specify the image to be used in the format of image_name:tag. Here, ‘nginx:latest’ is used.
Step 2: As Nginx by default listens to port 80, we will add 80 in the container field as it is the internal port that the service uses. In the host field that uses an external port on web browser. In the end, press the ‘Deploy the container’ button.
After completing the above steps, to verify the creation of the defined container, one can check on the dashboard.
So, we’ve learned about deploying the Nginx application on a container using Portainer. Also, Portainer is a very efficient tool as it is capable of managing the Docker environment in detail. For further details about Portainer, refer to this link.