Looking for a powerful web-based Docker container manager? Jack Wallen shows you how to deploy one of the best on the market.
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.
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 A).
Since we’ve installed the Docker Engine on the same host we’ve deployed Portainer, click the Local tab and then click Connect (Figure B).
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.