James Liang/Installing Portainer CE with Docker

Created Sat, 20 Mar 2021 23:05:27 -0500 Modified Wed, 27 Oct 2021 00:48:31 +0000
153 Words

Introduction

Portainer allows you to manage containers. I use Portainer CE to manage my Docker containers.

Installing Docker

I’m installing this on my Ubuntu Server 20.04. First install any updates and then install Docker.

sudo apt update
sudo apt upgrade
sudo apt-get update
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg \
    lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \
  "deb [arch=amd64 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-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io

After running the commands above, Docker should be installed.

Installing Portainer

Installing Portainer requires only 2 commands.

docker volume create portainer_data
docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce

To access Portainer, connect to your server’s IP on port 9000. After setting up a password you are done!