Latest Posts

Portainer Usage Introduction

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:

[email protected]:/# curl -sSL | sh
[email protected]:/# docker volume create portainer_data

[email protected]:/# 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

[email protected]:/# which docker

[email protected]:/# 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
[email protected]:/# docker stop portainer
[email protected]:/# 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
[email protected]:/# 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

If you only do start portainer, it won't use the latest image to start. You will have to remove old version container, then create a new portainer with downloaded new image.
[email protected]:/# 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

[email protected]:/# docker container rm 4cf95554b471
Error response from daemon: You cannot remove a running container 4cf95554b471baa13e15e016a19ceacfdd7d2cb0e5ee5d0d5be837c521168691. Stop the container before attempting removal or force remove
[email protected]:/# docker stop portainer
[email protected]:/# docker container rm 4cf95554b471
[email protected]:/# 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
[email protected]:/#

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

[email protected]:/# 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

[email protected]:/# 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

[[email protected] ~]# 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
[[email protected] ~]#

[[email protected]centos1docker ~]# docker exec -it portainer-nginx1 /bin/bash
[email protected]26a4cc3a312a:/#
[email protected]26a4cc3a312a:/# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION="10 (buster)"
[email protected]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

[email protected]:/# apt-get update
[email protected]:/# apt-get install iputils-ping
[email protected]:/# apt-get install telnet
[email protected]:/# apt-get install traceroute
[email protected]:/# apt-get install net-tools

Note: net-tools will include ifconfig command

No comments