In the event you’ve deployed Portainer as a Kubernetes growth platform and wish to add a special atmosphere, you are in luck — the method is kind of easy.
Not too long ago, I outlined the way to deploy Portainer to a MicroK8s Kubernetes cluster. The method is surprisingly straightforward and goes a protracted option to strip the problems from Kubernetes. That Kubernetes atmosphere makes for a sturdy growth 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’s essential develop for Kubernetes or Docker inside the similar web-based GUI. On this tutorial, I’ll present you the way to add a Docker atmosphere to the identical Portainer occasion that was deployed utilizing MicroK8s.
What you’ll want so as to add a Docker atmosphere to Portainer
The one stuff you’ll want for this course of are a operating occasion of Portainer and a person with sudo privileges. I’ll show 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 on/apt/sources.record.d/docker.record > /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 most recent 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 person 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 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 atmosphere.
The best way to add the Docker atmosphere to Portainer
Now, you’re prepared so as to add the Docker atmosphere 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 atmosphere a Title and an Setting Tackle, after which click on Join. The Setting Tackle will probably 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 the event you then click on House within the upper-left nook, you’ll see your new Docker atmosphere is able to use (Determine D).
Simplify your container growth course of
In the event you’re a platform engineer, developer or different person who’s seeking to simplify your container growth course of, I like to recommend utilizing Portainer for Kubernetes and Docker. This internet GUI has every thing it’s essential not solely excellent your container deployments however handle them as nicely.
Learn subsequent: The 12 finest IDEs for programming (TechRepublic)