Categories
Server admin

Installing Docker and Portainer

So I recently needed to install docker and portainer so that I could run a few services on my server.

Installing docker

This is just helpful links for installing docker on ubuntu or lubuntu for me on lubuntu 22.04.
the most important commands on that were:

sudo apt update && sudo apt upgrade -y
sudo apt install docker.io
docker --version

After that you should be able to to test that your installation is installed and running.

How to install portainer once you have docker running

My main source for this section is https://docs.portainer.io/v/ce-2.9/start/install/server/docker/linux
The most important important commands to run from that article are below.

sudo docker volume create portainer_data
sudo docker container run -d --name portainer -p 8080:9000 \
--restart=always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v portainer_data:/data portainer/portainer
sudo docker start portainer
sudo docker container ls

To login to portainer

To login to portainer, the instructions say to use https://localhost:9443 of course I’m logging in remotely, so I thought that I could just replace localhost with the ip address of my server, but that didn’t work, but port forwarding with an ssh tunnel did work. To forward the port, I had to run the following command

ssh -L localhost:9443:localhost:9443 [email protected]
in chrome: https://localhost:9443

Only after running that command, could I use the localhost address in chrome on my remote machine.

Leave a comment