- Collection for Interesting Docker Images
- Collection for Cyber Security Related Dockers
- Collection for Cloud Storage and Downloading Docker
- Docker Usage Introduction (Tips and Tricks)
- Portainer Usage Introduction
Install Docker and Portainer
/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: https://portainer.readthedocs.io/en/latest/deployment.html . You can use a bind mount on Linux to persist the data on the Docker host folder:
#Ubuntu 20.04
sudo apt install docker.io
sudo apt install docker-compose
#CentOS 7, Debian, Ubuntu 18.04/16.04
curl -sSL https://get.docker.com/ | sh
systemctl start docker
systemctl enable docker
curl -L "https://get.daocloud.io/docker/compose/releases/download/1.28.6/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
[root@localhost ~]# docker version Client: Docker Engine - Community Version: 20.10.5 API version: 1.41 Go version: go1.13.15 Git commit: 55c4c88 Built: Tue Mar 2 20:33:55 2021 OS/Arch: linux/amd64 Context: default Experimental: true Server: Docker Engine - Community Engine: Version: 20.10.5 API version: 1.41 (minimum version 1.12) Go version: go1.13.15 Git commit: 363e9a8 Built: Tue Mar 2 20:32:17 2021 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.4.4 GitCommit: 05f951a3781f4f2c1911b05e61c160e9c30eaa8e runc: Version: 1.0.0-rc93 GitCommit: 12644e614e25b05da6fd08a38ffa0cfe1903fdec docker-init: Version: 0.19.0 GitCommit: de40ad0 [root@localhost ~]# curl -L "https://get.daocloud.io/docker/compose/releases/download/1.28.6/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 379 100 379 0 0 140 0 0:00:02 0:00:02 --:--:-- 140 100 633 100 633 0 0 217 0 0:00:02 0:00:02 --:--:-- 7112 100 11.6M 100 11.6M 0 0 3178k 0 0:00:03 0:00:03 --:--:-- 3178k [root@localhost ~]# chmod +x /usr/local/bin/docker-compose [root@localhost ~]# docker-compose version docker-compose version 1.28.6, build 5db8d86f docker-py version: 4.4.4 CPython version: 3.7.10 OpenSSL version: OpenSSL 1.1.0l 10 Sep 2019
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-ce:latest
root@Ubuntu18:/# which docker
root@Ubuntu18:/# find . -type d -name "portainer_data"
./var/lib/docker/volumes/portainer_data
or in CentOS:
[root@centos-nextcloud-aria2 ~]# find / -type d -name "portainer_data"
/var/lib/docker/volumes/portainer_data
You can try out the public demo instance: http://demo.portainer.io/ (login with the username admin and the password tryportainer).
Update Portainer
1. Update imageÂ
1.1 Older version upgrade to 2.0Â
root@Ubuntu18:/# docker stop portainer
portainer
root@Ubuntu18:/# docker rm portainer
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.
root@Ubuntu18:/# docker pull portainer/portainer-ce:latest
portainer
If you could not find image, just use command "docker search portainer-ce"
[root@centos7-docker-portainer ~]# docker search portainer-ce
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
portainer/portainer This Repo is now deprecated, use portainer/p… 2033
portainer/portainer-ce Portainer CE - Making Docker and Kubernetes … 398
thibaudlabat/portainer_32 Portainer built for 32bit Linux [ OUTDATED ]… 1
thibaudlabat/portainer-ce-32 32-bit / x86 portainer-ce 0
terryromeu3sr/portainer-ce 0
luomoxu/portainer-ce-cn 0
nativeit/portainer-ce 0
6053537/portainer-ce 0
hanlahanla/portainer-ce 0
docker service update --image portainer/portainer-ce:latest portainer
1.2 Upgrade to latest (Current Version is higher 2.0)
root@hpthin:~# docker ps -a | grep portainer
ea61e3109076  portainer/portainer-ce:latest  "/portainer"       19 months ago  Up 4 weeks       8000/tcp, 0.0.0.0:9000->9000/tcp, :::9000->9000/tcp                                             hp-tc-portainer
root@hpthin:~# docker stop ea61e3109076
ea61e3109076
root@hpthin:~# docker rm ea61e3109076
ea61e3109076
root@hpthin:~# docker pull portainer/portainer-ce:latest
latest: Pulling from portainer/portainer-ce
772227786281: Pull complete
96fd13befc87: Pull complete
0bad1d247b5b: Pull complete
b5d1b01b1d39: Pull complete
Digest: sha256:f7607310051ee21f58f99d7b7f7878a6a49d4850422d88a31f8c61c248bbc3a4
Status: Downloaded newer image for portainer/portainer-ce:latest
docker.io/portainer/portainer-ce:latest
root@hpthin:~# 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-ce
f9a7d0df8e2e38d01c9d572236dc8dcb2d3bf21444311b1a0fbf0e7053a8bdb9
root@hpthin:~# docker image ls
REPOSITORYÂ Â Â Â Â Â Â Â TAGÂ Â Â Â IMAGE IDÂ Â Â Â CREATEDÂ Â Â Â Â SIZE
portainer/portainer-ce  latest  5f11582196a4  2 months ago  287MB
openspeedtest/latest   latest  98b90897430c  19 months ago  55.6MB
portainer/portainer-ce  <none>  8bd64518b976  19 months ago  210MB
pihole/pihole      latest  257fd58747c5  21 months ago  335MB
luodaoyi/kms-server   latest  3ed72d142784  24 months ago  5.74MB
root@hpthin:~# docker image rm 8bd64518b976
Untagged: portainer/portainer-ce@sha256:79edf1302c9b4fdb06bc23321cc551e9118c29e6d668e12e23d4e58d993ab830
Deleted: sha256:8bd64518b97697ed2d0d00b5dfd46260f729cdb5ae8120b38e404a05ad08f61b
Deleted: sha256:552b482deea1a69a4e787000b4a92348d8d46b820cfa7795cd1039db1f9183d3
Deleted: sha256:0f434987961209eca0504583fba181d92a59aa39c5b76f6e82a00a932cda1c38
Deleted: sha256:2365c13d7baf5be2ddb9f13ac4884996d67d7aa93b2b1ae6cccfd80b8a509415
root@hpthin:~# docker image ls
REPOSITORYÂ Â Â Â Â Â Â Â TAGÂ Â Â Â IMAGE IDÂ Â Â Â CREATEDÂ Â Â Â Â SIZE
portainer/portainer-ce  latest  5f11582196a4  2 months ago  287MB
openspeedtest/latest   latest  98b90897430c  19 months ago  55.6MB
pihole/pihole      latest  257fd58747c5  21 months ago  335MB
luodaoyi/kms-server   latest  3ed72d142784  24 months ago  5.74MB
root@hpthin:~#
2. Start Container with new image
[root@centos7-docker-portainer ~]# 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-ce
Unable to find image 'portainer/portainer-ce:latest' locally
latest: Pulling from portainer/portainer-ce
94cfa856b2b1: Pull complete
49d59ee0881a: Pull complete
527b866940d5: Pull complete
Digest: sha256:5064d8414091c175c55ef6f8744da1210819388c2136273b4607a629b7d93358
Status: Downloaded newer image for portainer/portainer-ce:latest
90212707d5a674ef3ba23588f25b014cea60b25e0f1826ed06e09ec568930b0a
3. Delete old image
Docker image lsdocker image rm <Repository name>
root@opc-ubuntu-docker:~# docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
portainer/portainer-ce latest 96a1c6cc3d15 4 weeks ago 209MB
portainer/portainer latest 62771b0b9b09 7 months ago 79.1MB
nginx latest e791337790a6 10 months ago 127MB
root@opc-ubuntu-docker:~# docker image rm portainer/portainer
Untagged: portainer/portainer:latest
Untagged: portainer/portainer@sha256:f8c2b0a9ca640edf508a8a0830cf1963a1e0d2fd9936a64104b3f658e120b868
Deleted: sha256:62771b0b9b0973a3e8e95595534a1240d8cfd968d30ec82dc0393ce0a256c5f3
Deleted: sha256:c291f08e07bbfde10ee7ae7a9c618ebedc5e5c4b3ab494b0636fb260e2a20717
Deleted: sha256:dd4969f97241b9aefe2a70f560ce399ee9fa0354301c9aef841082ad52161ec5
root@opc-ubuntu-docker:~# docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
portainer/portainer-ce latest 96a1c6cc3d15 4 weeks ago 209MB
nginx latest e791337790a6 10 months ago 127MB
YouTube Video:
- docker rm `docker ps -a -q`
Check Containers
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 0.0.0.0:80->80/tcp nginx1 4cf95554b471 4cda95efb0e4 "/portainer" 4 weeks ago Up 11 minutes 0.0.0.0:9000->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 psCONTAINER IDÂ Â Â Â IMAGEÂ Â Â Â Â Â Â Â Â COMMANDÂ Â Â Â Â Â Â Â Â CREATEDÂ Â Â Â Â Â Â STATUSÂ Â Â Â Â Â Â PORTSÂ Â Â Â Â Â Â Â Â Â NAMES
26a4cc3a312a    nginx:latest     "nginx -g 'daemon of…"  24 hours ago    Up 16 minutes    0.0.0.0:80->80/tcp    portainer-nginx1
d5c3f33bd8ee    portainer/portainer  "/portainer"       25 hours ago    Up 25 hours     0.0.0.0:9000->9000/tcp  portainer
[root@centos1docker ~]#
[root@centos1docker ~]# docker exec -it portainer-nginx1 /bin/bash
root@26a4cc3a312a:/#
root@26a4cc3a312a:/# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
Install Network Utilities in Container
root@26a4cc3a312a:/# apt-get install traceroute
Note: net-tools will include ifconfig / netstat commands
Reset Portainer Admin Password
[root@centos ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f554ef7dd8ed portainer/portainer:latest "/portainer" 9 months ago Up 6 months 0.0.0.0:9000->9000/tcp portainer
[root@centos ~]#
[root@centos ~]# docker stop portainer
portainer
[root@centos ~]# docker run --rm -v portainer_data:/data portainer/helper-reset-password
Unable to find image 'portainer/helper-reset-password:latest' locally
latest: Pulling from portainer/helper-reset-password
79916c70cb9e: Pull complete
93e26fa95550: Pull complete
Digest: sha256:735a809b1bfe14b5fae340d4b350bae97c2016371c47fb6e34d71a45e4512f79
Status: Downloaded newer image for portainer/helper-reset-password:latest
2021/04/20 13:31:09 Password succesfully updated for user: admin
2021/04/20 13:31:09 Use the following password to login: ]{1og%rNJp@k"70l469M!yxSOi+?53Yb
[root@centos ~]# docker start portainer
portainer
Now you should be able to log in usign admin account with generated password.Custom Bridge Network
Create a new bridge network to join your Containers into same network. In this way, they can access it through their name directly.
Get your Docker Container to join into your new created bridge network.
No comments:
Post a Comment