Portainer is a great way to help make Docker container development much more efficient. If your company has an official DockerHub registry, you should connect the two. Jack Wallen shows you how.
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.
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).
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).
In the Add Registries window (Figure C), click DockerHub at the top.
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).
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.