20170527

1.Deployment

Portainer is built to run on Docker and is really simple to deploy.

Portainer deployment scenarios can be executed on any platform unless specified.

Quick start

Deploying Portainer is as simple as:

$ docker run -d -p 9000:9000 portainer/portainer
Voilà, you can now access Portainer by pointing your web browser at http://DOCKER_HOST:9000

Ensure you replace DOCKER_HOST with address of your Docker host where Portainer is running.

You‘ll then be prompted to specify a new password for the admin account. After specifying your password, you‘ll then be able to connect to the Portainer UI.

Manage a new endpoint

After your first authentication, Portainer will ask you information about the Docker endpoint you want to manage.

You‘ll have the following choices:

Not available for Windows Containers (Windows Server 2016) - Manage the local engine where Portainer is running (you‘ll need to bind mount the Docker socket via -v /var/run/docker.sock:/var/run/docker.sock on the Docker CLI when running Portainer)
Manage a remote Docker engine, you‘ll just have to specify the url to your Docker endpoint, give it a name and TLS info if needed
Declare initial endpoint via CLI

You can specify the initial endpoint you want Portainer to manage via the CLI, use the -H flag and the tcp:// protocol to connect to a remote Docker endpoint:

$ docker run -d -p 9000:9000 portainer/portainer -H tcp://<REMOTE_HOST>:<REMOTE_PORT>
Ensure you replace REMOTE_HOST and REMOTE_PORT with the address/port of the Docker engine you want to manage.

You can also bind mount the Docker socket to manage a local Docker engine (not available for Windows Containers (Windows Server 2016)):

$ docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer
Note: If your host is using SELinux, you‘ll need to pass the --privileged flag to the Docker run command:

$ docker run -d -p 9000:9000 --privileged -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer
Connect to a Swarm cluster

Portainer will automatically detect if your endpoint is part of a Swarm cluster (either Docker Swarm or Swarm mode).

Note: Ensure you connect to either a primary node when connecting to a Docker Swarm cluster or a manager node when connecting to a cluster created with Docker swarm mode.

As simple as:

$ docker run -d -p 9000:9000 portainer/portainer -H tcp://<SWARM_MANAGER_IP>:2375
Alternatively, if you‘re using swarm mode, you can also deploy it as a service in your cluster:

$ docker service create \
--name portainer \
--publish 9000:9000 \
--constraint ‘node.role == manager‘ \
--mount type=bind,src=//var/run/docker.sock,dst=/var/run/docker.sock \
portainer/portainer \
-H unix:///var/run/docker.sock
Connect to a Docker engine with TLS enabled

If your Docker engine is protected using TLS, you‘ll need to ensure that you have access to CA, the certificate and the public key used to access your Docker engine.

You can upload the required files via the Portainer UI or use the --tlsverify flag on the CLI.

Portainer will try to use the following paths to the files specified previously (on Linux, see the configuration section for details about Windows):

CA: /certs/ca.pem
certificate: /certs/cert.pem
public key: /certs/key.pem
You must ensure these files are present in the container using a bind mount:

$ docker run -d -p 9000:9000 -v /path/to/certs:/certs portainer/portainer -H tcp://<DOCKER_HOST>:<DOCKER_PORT> --tlsverify
You can also use the --tlscacert, --tlscert and --tlskey flags if you want to change the default path to the CA, certificate and key file respectively:

$ docker run -d -p 9000:9000 -v /path/to/certs:/certs portainer/portainer -H tcp://<DOCKER_HOST>:<DOCKER_PORT> --tlsverify --tlscacert /certs/myCa.pem --tlscert /certs/myCert.pem --tlskey /certs/myKey.pem
Persist Portainer data

By default, Portainer will store its data inside the container in the /data folder on Linux (C:\data on Windows, this can be changed via CLI, see configuration).

You‘ll need to persist Portainer data to keep your changes after restart/upgrade of the Portainer container. You can use a bind mount to persist the data on the Docker host folder:

$ docker run -d -p 9000:9000 -v /path/on/host/data:/data portainer/portainer
On Windows:

$ docker run -d -p 9000:9000 -v C:\ProgramData\Portainer:C:\data portainer/portainer:windows
If you deployed Portainer as a Docker Swarm service:

$ docker service create \
--name portainer \
--publish 9000:9000 \
--constraint ‘node.role == manager‘ \
--mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock \
--mount type=bind,src=/path/on/host/data,dst=/data \
portainer/portainer \
-H unix:///var/run/docker.sock
Secure Portainer using SSL

By default, Portainer‘s web interface and API is exposed over HTTP. This is not secured, it‘s recommended to enable SSL in a production environment.

To do so, you can use the following flags --ssl, --sslcert and --sslkey:

$ docker run -p 443:9000 -v ~/local-certs:/certs portainer --ssl --sslcert /certs/portainer.crt --sslkey /certs/portainer.key
You can use the following commands to generate the required files:

$ openssl genrsa -out portainer.key 2048
$ openssl ecparam -genkey -name secp384r1 -out portainer.key
$ openssl req -new -x509 -sha256 -key portainer.key -out portainer.crt -days 3650
Note that Certbot could be used as well to generate a certificate and a key.

Without Docker

Portainer binaries are available on each release page: Portainer releases

Download and extract the binary to a location on disk:

$ cd /opt
$ wget https://github.com/portainer/portainer/releases/download/1.13.1/portainer-1.13.1-linux-amd64.tar.gz
$ tar xvpfz portainer-1.13.1-linux-amd64.tar.gz
Then just use the portainer binary as you would use CLI flags with Docker.

Note: Portainer will try to write its data into the /data folder by default. You must ensure this folder exists first.

$ mkdir /data
$ cd /opt
$ ./portainer/portainer
You can use the -p flag to serve Portainer on another port:

$ ./portainer/portainer -p :8080
You can change the folder used by Portainer to store its data with the -d flag:

$ ./portainer/portainer -d /opt/portainer-data
2.docker comand
docker rm $(docker ps -a -q)
curl -sSL https://shipyard-project.com/deploy | bash -s
3.docker Swarm
Docker - 配置国内加速器加速镜像下载。

引言
由于网络原因,我们在pull Image 的时候,从Docker Hub上下载会很慢。。。所以,国内的Docker爱好者们就添加了一一些国内的镜像(mirror),方便大家使用。

配置阿里云加速器
1. 登录阿里开发者平台:https://dev.aliyun.com/search.html

2. 点击“创建我的容器镜像”

3. 注册/登录后,进入Docker 镜像仓库 (https://cr.console.aliyun.com/#/imageList),选中加速器 Tab

这里可以看到,系统已经为我们生成了一个专属加速器地址:https://xxxxx.mirror.aliyuncs.com

4. 根据个人需要, 选择运行Docker 的OS,按照要求修改Docker配置文件

我这里的OS是CentOS, docker版本是1.12, 所以步骤如下:

修改配制文件 : vim usr/lib/systemd/system/docker.service

添加红色部分到 "ExecStart" ExecStart=/usr/bin/dockerd --registry-mirror=<your accelerate address>

保存文件

重新加载配制:$ systemctl daemon-reload

重新启动服务:$ service docker restart

验证
在Docker client 上面Pull 一个 MySQL, 看看速度如何

时间: 2024-07-30 06:16:28

20170527的相关文章

Linux每天一个命令:tar

Linux tar命令简介: tar命令可以为linux的文件和目录创建档案.利用tar,可以为某一特定文件创建档案(备份文件),也可以在档案中改变文件,或者向档案中加入新的文件.tar最初被用来在磁带上创建档案,现在,用户可以在任何设备上创建档案.利用tar命令,可以把一大堆的文件和目录全部打包成一个文件,这对于备份文件或将几个文件组合成为一个文件以便于网络传输是非常有用的. 首先要弄清两个概念:打包和压缩.打包是指将一大堆文件或目录变成一个总的文件:压缩则是将一个大的文件通过一些压缩算法变成

聚币网API使用教程 demo

原文 http://30daydo.com/article/181 目前还在完善,等功能完善了,就更新到csdn. 更新 2017-05-27 官方有API的文档,可是这个文档就像一个草稿一样,两个基本例子都没有. 所以自己摸索一下,自己写一个现成的例子给大家,可以有个参考. 首先看一下官方的API文档: 一.API使用说明 1.请求过程说明 1.1 构造请求数据,用户数据按照Jubi提供的接口规则,通过程序生成签名和要传输给Jubi的数据集合: 1.2 发送请求数据,把构造完成的数据集合通过P

c/c++日期时间处理与字符串string转换

在c/c++实际问题的编程中,我们经常会用到日期与时间的格式,在算法运行中,通常将时间转化为int来进行计算,而处理输入输出的时候,日期时间的格式却是五花八门,以各种标点空格相连或者不加标点. 首先,在c中,是有一个标准的日期时间结构体的,在标准库wchar.h内,我们可以看到结构体tm的声明如下: 1 #ifndef _TM_DEFINED 2 struct tm { 3 int tm_sec; /* seconds after the minute - [0,59] */ 4 int tm_

Python2.7 学习体会 @classmethod @staticmethod @property 之间的关系

先来一个实例场景,然后测试,比较,不懂的话到网上找资料: #!/usr/bin/env python #!/usr/bin/env python class Date(object):     def __init__(self,year=0,month=0,day=0):         self.year = year         self.month = month         self.day = day @staticmethod     def statictime(self

为女票写的计算工作时间的SQL(二)

将非工作时间.非工作日.节假日去掉,计算工作时间,如下: 一.实现 -- 节假日表 CREATE TABLE Holiday ( id INT(10) DEFAULT 0 NOT NULL, DATE DATETIME(6), flag INT(1) DEFAULT 0, PRIMARY KEY (id) ); -- 向节假日表中插入数据 INSERT INTO Holiday (id, date, flag) VALUES (1, '2017-04-01 00:00:00', '1'); IN

re.match re.search re.findall区别

re正则表达式里面,常用的三种方法的区别. re.macth和search匹配得到的是match对象,findall得到的是一个列表. match从字符串开头开始匹配,search返回与正则表达式匹配的第一个子串,findall则返回所有匹配到的. 如果要匹配的东西是字符串中唯一的只有一个或者直线那个取一个,最好不用findall,findall能匹配所有必然会查找整个字符串,search找到一个就结束查找了.废话不多说,选取一个页面源码大的网页,例如获取新浪网页的编码. #coding=utf

解决hiveserver2报错:java.io.IOException: Job status not available - Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask

用户使用的sql: select count( distinct patient_id ) from argus.table_aa000612_641cd8ce_ceff_4ea0_9b27_0a3a743f0fe3; 下面做不同的测试: 1.beeline -u jdbc:hive2://0.0.0.0:10000 -e "select count( distinct patient_id ) from argus.table_aa000612_641cd8ce_ceff_4ea0_9b27_

codeforces 735C Tennis Championship(贪心+递推)

Tennis Championship 题目链接:http://codeforces.com/problemset/problem/735/C --每天在线,欢迎留言谈论. 题目大意: 给你一个 n (2≤n≤10^18),代表一共有n位参加比赛的选手. 游戏规则: ①每次比赛,输的选手将离开赛场 ②相互比赛的选手 他们的获胜的次数相差不能超过1(获胜4次的选手只能跟3或5次的选手比赛) 问题:最终赢得比赛的选手,胜场最多能为多少. 思路: 贪心:①选一名选手让他一直获胜且优先让他参加比赛 ②当

javascript-封装Date日期类

迁移时间:2017年5月27日18:43:02 Author:Marydon (一)对日期进行格式化 //自定义Date日期类的format()格式化方法 <script type="text/javascript"> // 对Date的扩展,将 Date 转化为指定格式的String // 月(M).日(d).小时(H).分(m).秒(s).季度(q) 可以用 1-2 个占位符, // 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字