How to Install Portainer using Docker on Ubuntu
Step 1: Install Docker on Ubuntu
Before using Portainer, ensure you have Docker installed. If not, follow these steps:
- Update your package manager's cache:
- Install required dependencies:
- Add Docker's official GPG key:
- Add the Docker repository:
- Update the package index:
- Install Docker:
- Start and enable the Docker service:
- Verify Docker installation:
sudo apt update
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io
sudo systemctl start docker
sudo systemctl enable docker
sudo docker --version
Step 2: Install Portainer
Deploy Portainer as a Docker container:
- Pull the Portainer Docker image:
- Create a Docker volume for Portainer data persistence:
- Start the Portainer container:
sudo docker pull portainer/portainer-ce
sudo docker volume create portainer_data
sudo docker run -d -p 9000:9000 --name portainer --restart always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce
Step 3: Access Portainer
Access Portainer's web interface:
- Open your web browser and navigate to:
http://your_server_ip:9000
Replace your_server_ip
with the IP address of your Ubuntu server.
Step 4: Set Up Portainer
Complete Portainer's setup:
- Choose a password for the admin user.
- Specify a Portainer agent endpoint (leave as default for local Docker).
- Click "Connect."
- Create an admin user account (username and password).
- Click "Create user."
- You'll be redirected to the Portainer dashboard to manage Docker resources.
That's it! You've successfully installed Portainer in a Docker container on Ubuntu and can now use it to manage your Docker resources through its web-based interface.