Image: Avigator Fortuner/Shutterstock

It was brought to my attention that the developers of Portainer are planning to deprecate the current image and will be replacing it by the end of Q1. Although the current image still functions, it’s important that you know how to use the new version, before the EOL of the previous.

Instead of using the deployment command for the original image, make sure you use the following:

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

Once the container is deployed, you will access it with https://SERVER:9443 (where SERVER is the IP address of the hosting server). As you were in the previous iteration (see below), you’ll be required to create a new admin password before you can continue. The resulting setup window (Figure A) is much easier than the previous versions.

Figure A

The new Portainer setup window streamlines the process of working with your containers.

Click Get Started and you’ll then be presented with the new Portainer main window, where you can begin to deploy and manage your containers.

Figure B

The new version of the Portainer container management tool is much-improved.

Since I last covered Portainer, things have changed a bit. That’s just how things evolve in technology. One minute something works, and the next you have to take extra steps to do the same thing. This is especially true within the realm of containers.

And given I haven’t touched on Portainer since 2017, it should be obvious that things have dramatically changed and improved. That’s why I want to not only revisit the subject but also demonstrate a more reliable method of deploying Portainer. This time around we’ll be running the container with persistent storage, so should something go awry, you still have your data.

SEE: 40+ open source and Linux terms you need to know (TechRepublic Premium)

What can you do with Portainer?

For those who aren’t familiar with Portainer, it’s a web-based GUI that allows you to take complete control over your container deployments. With this tool, you can pull images, add containers, add networks and endpoints, create registries and much more. In fact, if you’re looking for a web-based Docker container management platform, this should be your go-to.

And, without further ado, let’s get to the deployment.

What you’ll need

I’ll be demonstrating on an instance of Ubuntu Server 20.04. You can deploy Portainer on any platform that supports Docker, so the only thing you might have to change in my instructions below is the installation of Docker on your operating system of choice.

You’ll also need a user with sudo privileges.

Ready?

How to install Docker

The first thing we’re going to do is install Docker (in case you don’t already have it installed). I want to install the community edition of the Docker engine, so log into your server and take care of the following.

First, install the dependencies with:

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

Next add the official Docker GPG key:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Now, we can add the Docker repository with the command:

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

Update apt and install Docker Engine with:

sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io

After the installation completes, add your user to the docker group with:

sudo usermod -aG docker $USER

Log out and log back in.

How to deploy Portainer

And now, we can deploy Portainer. The first thing we do is create a directory to house the data. Create that directory with the following commands:

docker volume create portainer_data

With the volume ready, deploy Portainer with:

docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer

Give the container time enough to pull and deploy. Once it has, point a browser to http://SERVER:9000 (Where SERVER is the IP address of the host). You will be greeted by a window requiring you to create a password for the admin user. Once you do that, you’ll see the Portainer setup window (Figure C).

Figure C

The Portainer setup window is ready for you to connect to the Docker Engine.

Since we’ve installed the Docker Engine on the same host we’ve deployed Portainer, click the Local tab and then click Connect (Figure D).

Figure D

Fortunately, we’ve started the Portainer container with the proper sock options.

Congratulations, you now have Portainer up and running, with persistent data, and are ready to start managing your container deployments. Enjoy that web-based, user friendly power.

Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the latest tech advice for business pros from Jack Wallen.

This article has been updated.

Subscribe to the Data Insider Newsletter

Learn the latest news and best practices about data science, big data analytics, artificial intelligence, data security, and more. Delivered Mondays and Thursdays

Subscribe to the Data Insider Newsletter

Learn the latest news and best practices about data science, big data analytics, artificial intelligence, data security, and more. Delivered Mondays and Thursdays