# Control Local Docker Containers From a Web Browser with Portainer

## What is Portainer

> Portainer is an open source tool for managing container-based software applications in Kubernetes, Docker, Docker Swarm, Azure ACI and edge environments.
> It can be used to set up and manage environments, deploy applications, monitor app performance and triage problems. It is used by software engineers, devops and infrastructure teams all over the world to simplify processes, reduce risk and streamline operations.

## Installing Docker

1. Log into the Linux based device
2. Run the following commands in the terminal
   # install prerequisites
   sudo apt install apt-transport-https ca-certificates curl software-properties-common gnupg-agent -y
   # add docker gpg key
   curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
   # add docker software repository
   sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
   # install docker
   sudo apt install docker-ce docker-compose containerd.io -y
   # enable and start docker service
   sudo systemctl enable docker && sudo systemctl start docker
   # add the current user to the docker group
   sudo usermod -aG docker $USER
   # reauthenticate for the new group membership to take effect
   su - $USER

## Running Portainer

1. Now that Docker is installed, run the following commands to setup the Portainer Docker container and run it
   # create working directories
   mkdir ~/docker/portainer -p
   # run the portainer docker container
   docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v ~/docker/portainer:/data portainer/portainer-ce
2. Once the Portainer container is downloaded and running, open a web browser and navigate to http://DNSorIP:9000
3. Set an administrator username and password > Click Create user
4. Click the Docker - Manage the local Docker environment option > Click Connect
5. Welcome to Portainer, Docker container management from a web browser

Documentation: https://www.portainer.io/installation/