How to Install Portainer with Docker in Ubuntu 20.04

by Danny
3 comments

READING TIME: 1 MINUTES

This tutorial will show you how to install Portainer with Docker on Ubuntu 20.04. Overall, you will learn how to install Docker-Compose, create a portainer volume, and then create the Portainer container.


Step 1: Install Docker Compose

To install Docker-Compose, open Putty and SSH into your server.

Then run this command:

sudo curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose

Then, set the permissions:

sudo chmod +x /usr/local/bin/docker-compose

Step 2: Create Portainer Volume

With Putty still open, create the Portainer volume.

sudo docker volume create portainer_data

Then, create the Portainer container:

sudo docker run -d -p 9000:9000 -p 8000:8000 --name portainer --restart always -v /var/run/docker.sock:/var/run/docker.sock -v /srv/portainer:/data portainer/portainer

Step 3: Start the Docker container.

sudo docker start portainer

Portainer should now be running at your server’s IP and port 9000. (i.e. – 192.168.68.141:9000). If you don’t know the IP address of your server, just type ifconfig into your terminal.

The username is admin with no default password, so you’ll need to create a password.

This is a local server, so you would choose Local, and then click Connect.

If you already have existing Docker containers, you should now see them under your Local section.


Wrapping Up

That’s it! You can now use Portainer to create multi-container applications such as BookStack.


My Homelab Equipment

Here is some of the gear I use in my Homelab. I highly recommend each of them.

The full list of server components I use can be found on my Equipment List page.

3 comments

You may also like

3 comments

stefan April 17, 2021 - 4:30 am

Hi.
Thanks for the tutorial; I am new at Docker/container/images and I have a doubt; shouldn’t a container be always build based on an image? in this case where is the portainer’s image?

Reply
Svein September 1, 2021 - 4:22 am

Will this tutorial also work if the OS is Ubuntu?

Reply
Danny September 1, 2021 - 4:28 am

Yes it will! I’m using a Ubuntu 20.04 VM with Docker and Docker-Compose installed. Or were you meaning without using Docker?

Reply

Leave a Comment