setup on portainer on ubunutu
- User
setup on portainer on ubunutu
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
setup on portainer on ubunutu
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Setting up Portainer on Ubuntu involves a few key steps: first, ensuring Docker is installed, and then deploying Portainer itself as a Docker container.
This guide will walk you through the recommended method for a standalone Portainer instance managing your local Docker environment.
Before You Begin:
sudo privileges.It's always a good idea to start with an up-to-date system.
sudo apt update
sudo apt upgrade -y
sudo apt install -y ca-certificates curl gnupg lsb-release
Portainer runs as a Docker container, so you need Docker installed on your Ubuntu machine. We'll install the Docker Engine (Community Edition) using Docker's official repository, which provides the latest stable version.
Add Docker's GPG key:
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
Set up the Docker repository:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Install Docker Engine:
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Verify Docker installation:
sudo systemctl status docker
sudo docker run hello-world
You should see a message confirming Docker is working.
Manage Docker as a non-root user (Recommended):
By default, you need sudo to run Docker commands. To avoid this, add your current user to the docker group:
sudo usermod -aG docker ${USER}
You need to log out and log back in (or reboot) for this change to take effect.
After logging back in, you can test it without sudo:
docker run hello-world
Portainer will be deployed as a Docker container. We'll create a Docker volume to store Portainer's data persistently.
Create a Docker volume for Portainer data:
docker volume create portainer_data
Deploy Portainer container:
docker run -d -p 8000:8000 -p 9443:9443 --name portainer --restart always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest
Let's break down this command:
-d: Runs the container in detached mode (in the background).-p 8000:8000: Maps port 8000 on the host to port 8000 in the container (used for Edge Agent communications, good to include even if not immediately needed).-p 9443:9443: Maps port 9443 on the host to port 9443 in the container (this is Portainer's web UI, which uses HTTPS by default).--name portainer: Assigns a name to the container for easy identification.--restart always: Ensures Portainer starts automatically when Docker starts (e.g., after a server reboot).-v /var/run/docker.sock:/var/run/docker.sock: This is crucial. It allows Portainer to communicate with and manage the Docker daemon on your host machine.-v portainer_data:/data: Mounts the portainer_data volume you created to the /data directory inside the container, where Portainer stores its configuration and database.portainer/portainer-ce:latest: Specifies the Portainer Community Edition image to use.Verify Portainer container status:
docker ps
You should see a portainer container with status Up ....
Open your web browser:
Navigate to https://your_ubuntu_ip_address:9443 (replace your_ubuntu_ip_address with the actual IP address or hostname of your Ubuntu server).
Create the administrator user: The first time you access Portainer, you'll be prompted to create the initial administrator user and password.
admin).Connect to your Docker environment: After creating the user, Portainer will ask you to connect to an environment.
You should now be on the Portainer dashboard! From here, you can:
your_ubuntu_ip_address:9443:
ufw by default. Allow the necessary ports:
sudo ufw allow 8000/tcp
sudo ufw allow 9443/tcp
sudo ufw reload
docker ps and docker logs portainer for errors.-v /var/run/docker.sock:/var/run/docker.sock mapping was incorrect, or the Docker service on your Ubuntu host is not running.
sudo systemctl status docker./var/run/docker.sock exists on your host.sudo after adding your user to the docker group, try logging out completely and logging back in, or even rebooting your machine.You've now successfully set up Portainer on your Ubuntu server!
Not yet included in a published release.