In case you’ve deployed Portainer as a Kubernetes improvement platform and wish to add a unique setting, you are in luck — the method is sort of easy.
Not too long ago, I outlined the best way to deploy Portainer to a MicroK8s Kubernetes cluster. The method is surprisingly straightforward and goes a protracted option to strip the issues from Kubernetes. That Kubernetes setting makes for a strong improvement course of, however what should you additionally have to work with Docker? Fortunately, Portainer has many handy Docker options that make deploying these containers a breeze.
SEE: Hiring package: Again-end Developer (TechRepublic Premium)
With Portainer, you’ll be able to add as many environments as it is advisable develop for Kubernetes or Docker inside the similar web-based GUI. On this tutorial, I’ll present you the best way to add a Docker setting to the identical Portainer occasion that was deployed utilizing MicroK8s.
What you’ll want so as to add a Docker setting to Portainer
The one stuff you’ll want for this course of are a working occasion of Portainer and a consumer with sudo privileges. I’ll display this on the Ubuntu Server 22.04 working system. In case your OS differs, you’ll want to change the steps for putting in Docker and Docker Compose.
How you can set up Docker and Docker Compose
To start, we should add the official Docker repository. We’ll first add the GPG key with this command:
curl -fsSL https://obtain.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
Subsequent, add the Docker repository:
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://obtain.docker.com/linux/ubuntu $(lsb_release -cs) steady" | sudo tee /and so forth/apt/sources.listing.d/docker.listing > /dev/null
From right here, you’ll want to put in the mandatory dependencies with this command:
sudo apt-get set up apt-transport-https ca-certificates curl gnupg lsb-release git -y
Set up newest Docker Engine
Now, we will set up the newest model of Docker Engine:
sudo apt-get replace
sudo apt-get set up docker-ce docker-ce-cli containerd.io -y
Subsequent, you’ll add your consumer to the docker group with this command:
sudo usermod -aG docker $USER
To complete out this part, log off and log again in for the modifications to take impact.
Set up Docker Compose
Lastly, we’ll set up Docker Compose with this command:
sudo apt-get set up docker-compose -y
With Docker put in, you’re prepared so as to add the brand new setting.
How you can add the Docker setting to Portainer
Now, you’re prepared so as to add the Docker setting to Portainer. To start, log in to your Portainer occasion and click on Environments underneath Settings (Determine A).
Within the ensuing window (Determine B), choose Docker Standalone and click on Begin Wizard.
Within the ensuing window (Determine C), choose Agent to disclose the Docker command you should run on the internet hosting server so as to add the Portainer agent.
The command to do that is:
docker run -d -p 9001:9001 --name portainer_agent --restart=at all times -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker/volumes:/var/lib/docker/volumes portainer/agent:2.16.2
When you’ve run that command, give the setting a Title and an Atmosphere Deal with, after which click on Join. The Atmosphere Deal with will likely be within the type of SERVER:9001, the place SERVER is the IP handle of the internet hosting server.
The connection ought to be made in a short time. In case you then click on House within the upper-left nook, you’ll see your new Docker setting is able to use (Determine D).
Simplify your container improvement course of
In case you’re a platform engineer, developer or different consumer who’s trying to simplify your container improvement course of, I like to recommend utilizing Portainer for Kubernetes and Docker. This net GUI has the whole lot it is advisable not solely good your container deployments however handle them as nicely.
Learn subsequent: The 12 finest IDEs for programming (TechRepublic)