For those who’ve deployed Portainer as a Kubernetes growth platform and wish to add a distinct atmosphere, you are in luck — the method is sort of easy.
Just lately, I outlined find out how to deploy Portainer to a MicroK8s Kubernetes cluster. The method is surprisingly simple and goes a protracted method to strip the problems from Kubernetes. That Kubernetes atmosphere makes for a sturdy growth course of, however what in case 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 may add as many environments as you must develop for Kubernetes or Docker inside the similar web-based GUI. On this tutorial, I’ll present you find out how to add a Docker atmosphere to the identical Portainer occasion that was deployed utilizing MicroK8s.
Leap to:
What you’ll want so as to add a Docker atmosphere to Portainer
The one belongings 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 many others/apt/sources.record.d/docker.record > /dev/null
From right here, you’ll want to put in the required 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, 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.
How you can 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 below 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 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=all the time -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 Identify and an Surroundings Deal with, after which click on Join. The Surroundings Deal with 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. For those who then click on House within the upper-left nook, you’ll see your new Docker atmosphere is able to use (Determine D).
Determine D
Simplify your container growth course of
For those who’re a platform engineer, developer or different consumer who’s seeking to simplify your container growth course of, I like to recommend utilizing Portainer for Kubernetes and Docker. This net GUI has every thing you must not solely excellent your container deployments however handle them as properly.
Learn subsequent: The 12 greatest IDEs for programming (TechRepublic)