Press "Enter" to skip to content

Portainer Usage


Install Docker and Portainer

By default, Portainer store its data inside the container in the /data folder on Linux (C:\\data on Windows).
You’ll need to persist Portainer data to keep your changes after restart/upgrade of the Portainer container.  Docker Deploy document: . You can use a bind mount on Linux to persist the data on the Docker host folder:
root@Ubuntu18:/# curl -sSL | sh
root@Ubuntu18:/# docker volume create portainer_data

root@Ubuntu18:/# docker run -d -p 9000:9000 --name portainer --restart always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer:latest

root@Ubuntu18:/# which docker

root@Ubuntu18:/# find . -type d -name "portainer_data"

You can try out the public demo instance: (login with the username admin and the password tryportainer).

Update Portainer

1. Update image

root@Ubuntu18:/# docker stop portainer
root@Ubuntu18:/# docker pull portainer/portianer
Using default tag: latest
Error response from daemon: pull access denied for portainer/portianer, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
root@Ubuntu18:/# docker pull portainer/portainer
Using default tag: latest
latest: Pulling from portainer/portainer
d1e017099d17: Already exists
292b789be2e4: Pull complete
Digest: sha256:63eb47d4b408c3f39e942368bcbf7e157a2b6e5dda94ffd403a14199e1137133
Status: Downloaded newer image for portainer/portainer:latest
root@Ubuntu18:/# docker start portainer

some os, you might need to use command “docker pull”

If you could not find image, just use command “docker search portainer”


 docker service update --image portainer/portainer:latest portainer

2. Delete Container and Re-create Portainer with new image

root@Ubuntu18:/# docker container rm 4cf95554b471
Error response from daemon: You cannot remove a running container 4cf95554b471baa13e15e016a19ceacfdd7d2cb0e5ee5d0d5be837c521168691. Stop the container before attempting removal or force remove
root@Ubuntu18:/# docker stop portainer
root@Ubuntu18:/# docker container rm 4cf95554b471
root@Ubuntu18:/# docker run -d -p 9000:9000 --name portainer --restart always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer:latest

3. Delete old image
Docker image ls
docker image rm <image id>

YouTube Video:

A useful command to get rid of the stopped containers:
docker rm `docker ps -a -q`

Check Container

root@Ubuntu18:/# docker container ls -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
a9ea9891aa03        nginx:latest        "nginx -g 'daemon of…"   4 weeks ago         Up 4 weeks>80/tcp       nginx1
4cf95554b471        4cda95efb0e4        "/portainer"             4 weeks ago         Up 11 minutes>9000/tcp   portainer
root@Ubuntu18:/# docker stats
CONTAINER ID        NAME                CPU %               MEM USAGE / LIMIT     MEM %               NET I/O             BLOCK I/O           PIDS
a9ea9891aa03        nginx1              0.00%               3.172MiB / 982.2MiB   0.32%               64.1MB / 132MB      14.6MB / 0B         3
4cf95554b471        portainer           0.01%               11.3MiB / 982.2MiB    1.15%               4.55MB / 50.2MB     90.7MB / 238MB      10

Log into Container

[root@centos1docker ~]# docker ps
CONTAINER ID        IMAGE                 COMMAND                  CREATED             STATUS              PORTS                    NAMES
26a4cc3a312a        nginx:latest          “nginx -g ‘daemon of…”   24 hours ago        Up 16 minutes>80/tcp       portainer-nginx1
d5c3f33bd8ee        portainer/portainer   “/portainer”             25 hours ago        Up 25 hours>9000/tcp   portainer
[root@centos1docker ~]#

[root@centos1docker ~]# docker exec -it portainer-nginx1 /bin/bash
root@26a4cc3a312a:/# cat /etc/os-release
PRETTY_NAME=”Debian GNU/Linux 10 (buster)”
NAME=”Debian GNU/Linux”
VERSION=”10 (buster)”

root@26a4cc3a312a:/# uname -a
Linux 26a4cc3a312a 3.10.0-1062.9.1.el7.x86_64 #1 SMP Fri Dec 6 15:49:49 UTC 2019 x86_64 GNU/Linux

Install Network Utilitis in Container

root@26a4cc3a312a:/# apt-get update
root@26a4cc3a312a:/# apt-get install iputils-ping
root@26a4cc3a312a:/# apt-get install telnet
root@26a4cc3a312a:/# apt-get install traceroute
root@26a4cc3a312a:/# apt-get install net-tools
Note: net-tools will include ifconfig command

Leave a Reply

%d bloggers like this: