When you’ve deployed Portainer as a Kubernetes improvement platform and need to add a special surroundings, you are in luck — the method is kind of easy.

Just lately, I outlined methods to deploy Portainer to a MicroK8s Kubernetes cluster. The method is surprisingly simple and goes a protracted technique to strip the issues from Kubernetes. That Kubernetes surroundings makes for a strong improvement course of, however what when you additionally have to work with Docker? Fortunately, Portainer has many handy Docker options that make deploying these containers a breeze.
SEE: Hiring equipment: Again-end Developer (TechRepublic Premium)
With Portainer, you possibly can add as many environments as it’s essential to develop for Kubernetes or Docker throughout the similar web-based GUI. On this tutorial, I’ll present you methods to add a Docker surroundings to the identical Portainer occasion that was deployed utilizing MicroK8s.
Leap to:
What you’ll want so as to add a Docker surroundings to Portainer
The one stuff you’ll want for this course of are a operating 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.
The best way to 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 are able to 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, sign off and log again in for the adjustments 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 surroundings.
The best way to add the Docker surroundings to Portainer
Now, you’re prepared so as to add the Docker surroundings to Portainer. To start, log in to your Portainer occasion and click on Environments underneath Settings (Determine A).
Determine A

Within the ensuing window (Determine B), choose Docker Standalone and click on Begin Wizard.
Determine B

Within the ensuing window (Determine C), choose Agent to disclose the Docker command you will need to run on the internet hosting server so as to add the Portainer agent.
Determine C

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 surroundings a Title and an Surroundings Deal with, after which click on Join. The Surroundings Deal with can be within the type of SERVER:9001, the place SERVER is the IP handle of the internet hosting server.
The connection must be made in a short time. When you then click on House within the upper-left nook, you’ll see your new Docker surroundings is able to use (Determine D).
Determine D

Simplify your container improvement course of
When you’re a platform engineer, developer or different consumer who’s seeking to simplify your container improvement course of, I like to recommend utilizing Portainer for Kubernetes and Docker. This internet GUI has every thing it’s essential to not solely good your container deployments however handle them as properly.
Learn subsequent: The 12 finest IDEs for programming (TechRepublic)