portainer使用二进制文件安装

本文涉及的产品
Serverless 应用引擎 SAE,800核*时 1600GiB*时
云原生网关 MSE Higress,422元/月
容器服务 Serverless 版 ACK Serverless,317元额度 多规格
简介: 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来过滤


相关文章
|
11月前
|
应用服务中间件 Linux 网络安全
docker安装使用以及tomcat部署超级详解
docker安装使用以及tomcat部署超级详解
346 0
|
2月前
|
Shell 数据安全/隐私保护 Docker
如何使用Docker安装FTP服务器?
【4月更文挑战第25天】
241 0
如何使用Docker安装FTP服务器?
|
8月前
|
Docker 容器
docker保存镜像、打包tar、加载tar镜像
本文记录docker保存镜像、打包tar、加载tar镜像。
905 0
|
2月前
|
Docker 容器
Docker【部署 03】一键离线安装Docker的自动化安装脚本分享(安装文件docker-20.10.13.tgz及脚本dockerInstall.sh)
Docker【部署 03】一键离线安装Docker的自动化安装脚本分享(安装文件docker-20.10.13.tgz及脚本dockerInstall.sh)
319 0
|
8月前
|
Linux Docker 容器
suse 12 脚本部署docker(二进制文件)
suse 12 脚本部署docker(二进制文件)
75 0
|
11月前
|
Ubuntu NoSQL Linux
MongoDB安装教程(二进制文件方式安装)—Ubuntu
MongoDB安装教程(二进制文件方式安装)—Ubuntu
264 0
|
应用服务中间件 Docker 容器
docker下载tomact
docker下载tomact
|
Kubernetes Cloud Native Java
Docker打包制作openoffice镜像(Dockerfile方式),并处理中文乱码
鉴于目前,云原生k8s的部署方式,越来越广泛。那我们也应该要使用docker的方式部署openoffice。 这个部署的第一步,就是要有一个docker镜像,那我们今天就来讲讲,如何制作openoffice的docker镜像包。 当然啦,openoffice的docker镜像包,我们可以从docker hub仓库,直接拉别人制作好的镜像包。
900 0
|
JSON 中间件 Linux
Windows安装Docker
Windows安装Docker
1745 0
Windows安装Docker
|
Docker 容器
docker将镜像文件保存到本地
docker将镜像文件保存到本地
670 0
docker将镜像文件保存到本地