portainer使用二进制文件安装

简介: portainer使用二进制文件安装

一.安装portainer

1.1 查看portainer版本信息

版本信息

可在此查看到每个版本的详细信息

1.2 下载文件

下载并将二进制文件

[root@localhost opt]# wget https://github.com/portainer/portainer/releases/download/1.20.1/portainer-1.20.1-linux-amd64.tar.gz
--2019-03-05 13:21:00--  https://github.com/portainer/portainer/releases/download/1.20.1/portainer-1.20.1-linux-amd64.tar.gz
正在解析主机 github.com (github.com)... 13.229.188.59, 52.74.223.119, 13.250.177.223
正在连接 github.com (github.com)|13.229.188.59|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 302 Found
位置:https://github-production-release-asset-2e65be.s3.amazonaws.com/59239347/7e700400-255c-11e9-9e54-5044865ea28f?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20190305%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20190305T052100Z&X-Amz-Expires=300&X-Amz-Signature=d728457eff5f21815f5ca5c64d3bcace5f8b850ecb66d80785f01de9ce4bf383&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Dportainer-1.20.1-linux-amd64.tar.gz&response-content-type=application%2Foctet-stream [跟随至新的 URL]
--2019-03-05 13:21:01--  https://github-production-release-asset-2e65be.s3.amazonaws.com/59239347/7e700400-255c-11e9-9e54-5044865ea28f?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20190305%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20190305T052100Z&X-Amz-Expires=300&X-Amz-Signature=d728457eff5f21815f5ca5c64d3bcace5f8b850ecb66d80785f01de9ce4bf383&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Dportainer-1.20.1-linux-amd64.tar.gz&response-content-type=application%2Foctet-stream
正在解析主机 github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)... 52.216.132.163
正在连接 github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)|52.216.132.163|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:21945155 (21M) [application/octet-stream]
正在保存至: “portainer-1.20.1-linux-amd64.tar.gz”

100%[==========================================================================================>] 21,945,155   570KB/s 用时 2m 1s  

2019-03-05 13:23:04 (177 KB/s) - 已保存 “portainer-1.20.1-linux-amd64.tar.gz” [21945155/21945155])

1.3 解压文件

解压缩到磁盘上的某个位置

[root@localhost opt]# tar zxvf portainer-1.20.1-linux-amd64.tar.gz 

[root@localhost opt]# ls
portainer

1.4 新建portainer数据存储目录

Portainer默认会尝试将其数据写入/ data文件夹,但我们可以更改它的数据存储目录

[root@localhost opt]# mkdir /opt/portainer-data

1.5 启动portainer

[root@localhost opt]# cd portainer
[root@localhost portainer]# ls
docker  portainer  public  templates.json

启动portainer
[root@localhost portainer]#  ./portainer --data /opt/portainer-data --template-file "${PWD}/templates.json" &
[1] 7824
[root@localhost portainer]# 2019/03/05 13:49:51 Starting Portainer 1.20.1 on :9000

[root@localhost portainer]# cd /opt/portainer-data/
[root@localhost portainer-data]# ls
bin  compose  config.json  portainer.db  portainer.key  portainer.pub  tls

==注意:==

如果portainer的默认端口9000在你的服务器已经被占用或者不方便使用,也使用该-p标志在另一个端口上为Portainer提供服务:

如下例:

[root@localhost portainer]#  ./portainer --data /opt/portainer-data  -p :8080 --template-file "${PWD}/templates.json" &
[1] 7949

[root@localhost portainer]# 2019/03/05 13:57:37 Templates already registered inside the database. Skipping template import.
2019/03/05 13:57:37 Starting Portainer 1.20.1 on :8080

[root@localhost portainer]# 
[root@localhost portainer]# netstat -lnptu
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp6       0      0 :::8080                 :::*                    LISTEN      7949/./portainer

==注意:==

可以在启动容器的时候直接在命令内设置参数,来修改portainer的默认行为,可使用的参数使用./portainer --help命令查看:

[root@localhost portainer]# ./portainer --help
usage: portainer [<flags>]

Flags:
      --help                     Show context-sensitive help (also try --help-long and --help-man).
      --version                  Show application version.
  -p, --bind=":9000"             Address and port to serve Portainer
  -a, --assets="./"              Path to the assets
  -d, --data="/data"             Path to the folder where the data is stored
  -H, --host=HOST                Endpoint URL
      --external-endpoints=EXTERNAL-ENDPOINTS  
                                 Path to a file defining available endpoints
      --no-auth                  Disable authentication
      --no-analytics             Disable Analytics in app
      --tlsverify                TLS support
      --tlsskipverify            Disable TLS server verification
      --tlscacert="/certs/ca.pem"  
                                 Path to the CA
      --tlscert="/certs/cert.pem"  
                                 Path to the TLS certificate file
      --tlskey="/certs/key.pem"  Path to the TLS key
      --ssl                      Secure Portainer instance using SSL
      --sslcert="/certs/portainer.crt"  
                                 Path to the SSL certificate used to secure the Portainer instance
      --sslkey="/certs/portainer.key"  
                                 Path to the SSL key used to secure the Portainer instance
      --sync-interval="60s"      Duration between each synchronization via the external endpoints source
      --snapshot                 Start a background job to create endpoint snapshots
      --snapshot-interval="5m"   Duration between each endpoint snapshot job
      --admin-password=ADMIN-PASSWORD  
                                 Hashed admin password
      --admin-password-file=ADMIN-PASSWORD-FILE  
                                 Path to the file containing the password for the admin user
  -l, --hide-label=HIDE-LABEL ...  
                                 Hide containers with a specific label in the UI
      --logo=LOGO                URL for the logo displayed in the UI
  -t, --templates=TEMPLATES      URL to the templates definitions.
      --template-file="/templates.json"  
                                 Path to the templates (app) definitions on the filesystem

二、portminer模板

portainer中可以自定义一些模板,然后在portainer中创建容器的时候使用这些模块快速的创建,模板是json格式的,包含一些必选项和可选项。

可看见在启动portminer时,添加的一个参数:--template-file "${PWD}/templates.json"
portminer模板便存储在templates.json文件中

摘取一段templates.json文件中的内容为大家解释一下

2.1 portminer模板样例

[root@localhost portainer]# ls
docker  portainer  public  templates.json
[root@localhost portainer]# cat templates.json 
[
  {
    "type": 1,
    "title": "Registry",
    "description": "Docker image registry",
    "categories": ["docker"],
    "platform": "linux",
    "logo": "https://portainer-io-assets.sfo2.digitaloceanspaces.com/logos/registry.png",
    "image": "registry:latest",
    "ports": [
      "5000/tcp"
    ],
    "volumes": [{ "container": "/var/lib/registry"}]
  },
  {
    "type": 1,
    "title": "Nginx",
    "description": "High performance web server",
    "categories": ["webserver"],
    "platform": "linux",
    "logo": "https://portainer-io-assets.sfo2.digitaloceanspaces.com/logos/nginx.png",
    "image": "nginx:latest",
    "ports": [
      "80/tcp",
      "443/tcp"
    ],
    "volumes": [{"container": "/etc/nginx"}, {"container": "/usr/share/nginx/html"}]
  },

2.2 portminer模板解释


type 必选项,1表示container,2表示swarm stack,3表示compose stack

title 必选项

description 必选项,该镜像描述

image 必选项,该应用使用的docker镜像

administrator_only 可选项,是否只有管理员可用模板

name 可选项,该模板在管理界面中显示的名称

logo 可选项,自定义的logo

registry 可选项,docker镜像的仓库,默认是Dockerhub

command 可选项,容器里面运行的命令,如果没有指定,则默认运行dockerfile的command

network 可选项,模板使用的网络

volumes 可选项,模板使用的volume

ports 可选项,模板exposed的端口

labels 可选项,模板上定义的labels

privileged 可选项,容器是否能在超级权限启动

interactive 可选项,容器启动时是否是交互模式,即添加-i -t

restart_policy 可选项,容器的重启策略

hostname 可选项,容器的主机名

note 可选项,关于模板的信息

platform 可选项,支持的平台,一般是linux或者windows

categories 可选项,模板的类别,可以在UI上通过category来过滤


相关文章
|
人工智能 Java API
Google Gemini API 接口调用方法
Google 最近发布的 Gemini 1.0 AI 模型通过其升级版,Gemini,标志着公司迄今为止最为强大和多功能的人工智能技术的突破。
|
Web App开发 域名解析 缓存
如何在 Ubuntu 20.04 上安装 Node.js 和 npm
本文我们主要为大家介绍在 Ubuntu 20.04 上安装 Node.js 和 npm 的三种不同的方式。
171728 7
如何在 Ubuntu 20.04 上安装 Node.js 和 npm
|
8月前
|
人工智能 自然语言处理 安全
99%成功率背后:阿里云短信群发平台哪些优势?收费价格多少钱一条?
阿里云短信群发平台,99%高送达率,支持全球200+国家和地区。高并发、安全API调用,多语言SDK快速接入。提供智能管控、防盗刷、AI模板助手等功能。短信低至0.01元/条,按量付费最低0.036元/条。
1021 1
|
存储 人工智能 JavaScript
Harmony OS开发-ArkTS三
本文介绍了ArkTS的基础语法,包括常量、命名规则、数组及其常用函数,以及函数的定义与使用,涵盖匿名函数和箭头函数的区别。通过具体示例,帮助读者快速掌握ArkTS编程技巧,踏上Harmony OS开发之旅。君志所向,一往无前!
905 1
Harmony OS开发-ArkTS三
inno setup打包软件学习
如何使用Inno Setup打包软件,包括打包结果的展示、示例打包脚本的提供、常见错误的解决方法,以及参考资料的链接。文中详细解释了解决“另一个程序正在使用此文件”和“桌面图标无法修改”等问题的方法,以及如何正确设置打包脚本中的文件路径和图标。
1376 1
inno setup打包软件学习
|
应用服务中间件 nginx Docker
Docker:WARNING: Published ports are discarded when using host network mode 解决方法
Docker在使用 `host`网络模式时会忽略端口映射,因为此模式下容器已经直接暴露在主机网络上。通过理解并合理选择网络模式,可以有效解决 `WARNING: Published ports are discarded when using host network mode`的警告。根据具体需求,选择适合的网络模式,以便在保证性能的同时确保灵活性和安全性。希望本文提供的方法和分析能帮助您在使用Docker时更好地处理网络配置问题。
3219 12
|
监控 应用服务中间件 数据安全/隐私保护
Portainer是一个用于管理Docker的开源工具
Portainer是一个用于管理Docker的开源工具
772 0
|
前端开发 JavaScript 开发者
利用 el-select 和 el-tree 实现树形结构多选框联动功能
本文详细介绍了如何使用ElementUI中的el-select下拉选择器和el-tree树形控件来实现多功能联动选择器,包括多选、删除、搜索、清空选项等功能。通过树形控件展示复杂的层级结构,用户可以通过下拉选择树形节点,实时搜索节点,且支持批量选择和删除功能。文中提供了完整的HTML、JavaScript和CSS代码实现,帮助开发者快速集成此功能。
6581 0
利用 el-select 和 el-tree 实现树形结构多选框联动功能
|
Kubernetes 网络协议 网络安全
在K8S中,k8s中service访问有问题,该如何排查?
在K8S中,k8s中service访问有问题,该如何排查?
|
Kubernetes API 容器
在k8S中,使用kubectl logs无法查看日志是什么原因,如何让其能够查看?
在k8S中,使用kubectl logs无法查看日志是什么原因,如何让其能够查看?