Where are you using WebAssembly?
Wasm promises to let developers build once and run anywhere. Are you using it yet?
At work, for production apps
At work, but not for production apps
I don’t use WebAssembly but expect to when the technology matures
I have no plans to use WebAssembly
No plans and I get mad whenever I see the buzzword
Cloud Native Ecosystem / Containers

Deploy Portainer for Easier Container Management

An investigation into Portainer for container management.
Mar 12th, 2022 10:00am by
Featued image for: Deploy Portainer for Easier Container Management

Containers can be a real challenge to manage. With so many moving parts and commands to work with, life can get a bit challenging. This is especially so as you scale up your deployments. One to make this a bit easier on you and/or your dev teams is to make use of a GUI tool that can be accessed from anywhere on your LAN. That way all of your developers can work much more efficiently, effectively, and reliably.

One such tool for this task is Portainer. This GUI can be deployed on top of Kubernetes, Docker, or Docker Swarm works seamlessly on a third-party cloud host or can be used on-prem or even at the edge.

Portainer gives you complete control over your containers, allowing you to pull images, create containers, networks and endpoints, and create registries. For anyone looking to employ a GUI to manage containers, you could do a lot worse than Portainer.

I’m going to walk you through deploying Portainer. I’ll be demonstrating on Ubuntu Server 20.04 with Docker, but the process will work with any platform that supports Docker or K8s. The only change you’ll have to make in the instructions is the installation of Docker for your operating system of choice. Of course, if you’re using this in the cloud, chances are pretty good you’re working with Linux, so the installation should be fairly straightforward.

Installing Docker

The first thing we must do is install Docker. Previously, I would have installed the version of Docker found in the standard repositories (with sudo apt-get install -y). However, we want to install the community edition of Docker, because that includes more features and is more regularly updated.

So, to install the Community edition, log into your Linux server and install the necessary dependencies with the command:

sudo apt-get install ca-certificates curl gnupg lsb-release -y

Next, we need to add the required GPG security key for Docker, which is done with:

curl -fsSL | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

With the GPG added, create the Docker repository with:

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Before we can install,  we must update apt:

sudo apt-get update

Finally, it’s time to install the Docker engine with:

sudo apt-get install docker-ce docker-ce-cli

Once the installation completes, we then need to add our user to the docker group. If you skip this step, you will only be able to work with Docker using sudo, which is a security risk you do not want to take. To add your user to the group, issue the command:

sudo usermod -aG docker $USER

Log out and log back into the server so the changes will take effect.

Deploy Portainer with Persistent Storage

We’ll be deploying Portainer with persistent storage, on the off chance something goes wrong with the deployment, you’ll still have access to your data.

The first thing we must do is create a volume that will contain the data. Do that with the command:

docker volume create portainer_data

The above command will create a volume named portainer_data. We can now deploy Portainer, connecting it to the volume with the command:

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

The deployment command will take a few minutes to complete. When the command returns the container IDs for the now-running Portainer deployment, open a web browser and point it to https://SERVER:9443 (where SERVER is the IP address of your hosting server).

In the resulting screen (Figure 1), you’ll be asked to create an initial admin user.

Portainer launch page.

Figure 1: Creating the initial admin user for Portainer.

Add a username and type/confirm a strong/unique password. Once you’ve done that, click Create user. Once you’ve done that, you’ll be automatically logged in with that new user credentials and you should see the Portainer Quick Setup window (Figure 2).

Portainer setup window.

Figure 2: The new Portainer Quick Setup window is much easier than previous incarnations.

Note: When you first access the Portainer site, you might also have to accept the security risk, as Portainer uses self-signed certificates. That’s fine, just accept the risk and no harm will come of it.

Click Get Started to use the local environment or, if you need to connect to a remote environment click Add Environments. After clicking Get Started, you should see your local environment listed (Figure 3).

Portainer environmental window.

Figure 3: The available environments will show up here.

Click on the listing marked local and you’ll be transported to the dashboard for that environment (Figure 4).

Portainer dashboard.

Figure 4: The Portainer Dashboard for the locally installed container engine.

You can now start easily creating networks and volumes, pulling down images and deploying containers, and even adding registries and other environments.


Anyone looking to add a level of efficiency to their container deployments would do well to consider Portainer. With a user-friendly web-based GUI and all the tools you need to manage your deployments, Portainer should be considered a top choice for container management.

For more information on Portainer, check out the official Portainer documentation.

Group Created with Sketch.
TNS owner Insight Partners is an investor in: Docker.
THE NEW STACK UPDATE A newsletter digest of the week’s most important stories & analyses.