欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Portainer 2020(4)Deploy Nginx and Others

程序员文章站 2022-03-30 19:24:34
...
Portainer 2020(4)Deploy Nginx and Others

My Portainer is running fine, it use remote connect to 2375 ports to other machines.

Choose an Endpoint first —> Containers —> Add Container
Name: onenginx
Registry: DockerHub
Image: nginx:latest
Manual network port publishing:
Host: 8800 —> container: 80 TCP
Click —> Deploy the Container

Check Image
> docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
nginx               latest              6678c7c2e56c        2 weeks ago         127MB

Check Container
> docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                  NAMES
13071a53b39b        nginx:latest        "nginx -g 'daemon of…"   29 seconds ago      Up 27 seconds       0.0.0.0:8800->80/tcp   onenginx

Visit the page
http://rancher-home:8800/

Just an UI tool to manage the Docker things for US.

Add my Customized Registry
Start my Registry on 5000
Start my Registry UI on 5001
Visit http://rancher-home:5001/ to view my images

On the Portainer UI Console

Registries —> Create Registry —>
Name: rancher-home-registry
Registry URL: rancher-home:5000
Click on —> Add registry

Tag a nginx and prepare in the customer registry
> docker tag nginx:latest rancher-home:5000/c-nginx:1
Push to our registry
> docker push rancher-home:5000/c-nginx:1
View that on the UI
http://rancher-home:5001/?page=1#!taglist/c-nginx

Go to the same steps to start a nginx on rancher-worker1
Name: twonginx
Registry: rancher-home-registry
Image: 192.168.56.110:5000 c-nginx:1
Manual network port publishing:
   Host: 8800 —> Container: 80
Click —> Deploy the container

Remember to add our registry to all the machines
> sudo vi /etc/docker/daemon.json

It works pretty well. The shortage is that it can not scaling and across machines.

References:
https://blog.csdn.net/weixin_40165163/article/details/97308718
https://blog.csdn.net/iteye_10432/article/details/99161578