Portainer is one of the best tools for managing your Docker container deployments. With a very user-friendly, web-based GUI, this tool makes working with images, registries, networks, stacks and more considerably easier than trying to handle the job from the command line.

SEE: Business leaders as developer: The rise of no-code and low-code software (free PDF) (TechRepublic)

But out of the box, Portainer is set to pull images from anonymous DockerHub. This is problematic for two reasons. First, it could be a security issue. You don’t want your developers to be willy-nilly pulling down just any container image, as you never know if it might contain malicious code. The second reason is you might have a company repository that contains images your developers have either built from scratch or developed from other, official images.

Either way, if you have a DockerHub account, you should definitely connect it with Portainer.

Let me show you how.

What you’ll need

To make this work, you’ll need a running instance of Portainer, admin credentials for Portainer, as well as a DockerHub account. That’s it … let’s make this connection.

How to create a DockerHub access token

The first thing you must do is create a DockerHub access token, which will be used in place of a password. Log into your company DockerHub account, click on the profile icon, and select Account Settings. In the resulting window, click Security in the left navigation and then click New Access Token (Figure A).

Figure A

Creating a DockerHub access token is required in order to connect to Portainer.
Creating a DockerHub access token is required in order to connect to Portainer.

Once you’ve created your access token, make sure to copy the string of characters (as that will be used for your account password).

How to connect Portainer to your DockerHub account

Log into Portainer and click Registries from the left sidebar. In the resulting window click Add registry (Figure B).

Figure B

You can add as many registries as you need to Portainer (even multiple DockerHub accounts).
You can add as many registries as you need to Portainer (even multiple DockerHub accounts).

In the Add Registries window (Figure C), click DockerHub at the top.

Figure C

The Portainer Add Registries window allows you to add numerous types of registries.
The Portainer Add Registries window allows you to add numerous types of registries.

Type a name for your registry, then add your DockerHub username (this is not the email address associated with the account, but the actual username), and then paste the access token in the password field. When finished, click Add registry to save the information.

How to use the new registry

Let’s say you have an image in your company DockerHub registry named nginx-template that’s tagged with latest. If you want to pull that image to Portainer, do the following:

Click Images in the left navigation.

In the Registry drop-down, select the DockerHub registry you just added (Figure D).

Figure D

Pulling down a specific image from your authenticated DockerHub registry.
Pulling down a specific image from your authenticated DockerHub registry.

In the Image field, you’ll type something like NAME/nginx-template:latest (where NAME is either the individual or company name associated with the image).

Click Pull the image.

And that’s all there is to adding and using an authenticated DockerHub registry to Portainer. If your company uses DockerHub and your container developers work with Portainer, this should be considered a must.

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

Subscribe to the Cloud Insider Newsletter

This is your go-to resource for the latest news and tips on the following topics and more, XaaS, AWS, Microsoft Azure, DevOps, virtualization, the hybrid cloud, and cloud security. Delivered Mondays and Wednesdays

Subscribe to the Cloud Insider Newsletter

This is your go-to resource for the latest news and tips on the following topics and more, XaaS, AWS, Microsoft Azure, DevOps, virtualization, the hybrid cloud, and cloud security. Delivered Mondays and Wednesdays