מבית היוצר של ניגי

Docker Install

sudo apt install docker.io
sudo systemctl enable docker
sudo systemctl start docker
sudo systemctl status docker

Portainer Install

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

Previous Requisites

Installing Portainer

To install Portainer in our system, we will create a Docker container using Docker Compose. In order to do that we will first create a file called docker-compose.yml with container’s definition, and then we will execute it in our system.

mkdir -p docker/portainer
cd docker/portainer
nano docker-compose.yml

Inside file docker-compose.yml we add the next content:

version: '3'

services:
  portainer:
    image: portainer/portainer-ce:latest
    container_name: portainer
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./portainer-data:/data
    ports:
      - 9000:9000

We save the information pressing Ctrl+X, y, ENTER.

We execute the container using Docker Compose:

docker-compose up -d

We open a web browser and access Portainer’s service we are running in Docker:

http://SERVER_IP:9000/

We create administrator user credentials filling in the form:

At last, we connect Portainer to local Docker instance:

How to installdocker composeportainer

Post navigation