docker常用容器部署
索引
镜像名,不加版本默认laster | 介绍 | 访问地址 |
---|---|---|
Portainer | docker可视化面板,默认端口9000 | IP:9000 |
Elasticsearch | 搜索引擎,默认端口9200 | IP:9200 |
mobz/elasticsearch-head:5 | Elasticsearch可视化界面,默认端口9100 | IP:9100 |
rabbitmq | 消息队列,默认端口1562 | IP:15672 |
nextcloud | 云存储,默认端口80 | IP:880 |
onlyoffice | nextcloud插件onlyoffice,默认端口80 | IP:6060 |
欢迎在本网站留言
docker和docker-Portainer可视化面板安装
可修改映射端口号,默认9000
docker pull docker.io/portainer/portainer
mkdir -p /data/portainer/data /data/portainer/public
cd cd /data/portainer
#汉化
wget https://dl.quchao.net/Soft/Portainer-CN.zip
unzip Portainer-CN.zip -d public
docker run -d --restart=always --name portainer \
-p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock \
-v /data/portainer/data:/data \
-v /data/portainer/public:/public portainer/portainer
#开机自启
docker update portainer --restart=always
docker-Portainer地址
http://IP:PORT
创建Elasticsearch容器
可修改映射端口号,默认9200
docker pull elasticsearch
#创建所需文件
mkdir -p /data/elasticsearch/config
mkdir -p /data/elasticsearch/data
#加入跨域注意:host: 冒号后有一空格
echo "http.host: 0.0.0.0">>/data/elasticsearch/config/elasticsearch.yml
echo "http.cors.enabled: true"">>/data/elasticsearch/config/elasticsearch.yml
echo "http.cors.allow-origin: "*"">>/data/elasticsearch/config/elasticsearch.yml
cd /data
chmod -R 777 elasticsearch/
docker run --name elasticsearch -p 9200:9200 \
-p 9300:9300 \
-e "discovery.type=single-node" \
-e ES_JAVA_OPTS="-Xms64m -Xmx128m" \
-v /data/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \
-v /data/elasticsearch/data:/usr/share/elasticsearch/data \
-v /data/elasticsearch/plugins:/usr/share/elasticsearch/plugins \
-d elasticsearch
#可视化界面elasticsearch-head安装
docker pull mobz/elasticsearch-head:5
docker run -d --name es_admin -p 9100:9100 mobz/elasticsearch-head:5
#开机自启
docker update elasticsearch --restart=always
docker update elasticsearch-head --restart=always
elasticsearch测试
http://IP:9200
elasticsearch-head测试http://IP:9100
/**
*--name elasticsearch:将容器命名为 elasticsearch
*-p 9200:9200:将容器的9200端口映射到宿主机9200端口
*-p 9300:9300:将容器的9300端口映射到宿主机9300端口,目的是集群互相通信
*-e "discovery.type=single-node":单例模式
*-e ES_JAVA_OPTS="-Xms64m -Xmx128m":配置内存大小
*-v /data/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml:将配置文件挂载到宿主机
*-v /data/elasticsearch/data:/usr/share/elasticsearch/data:将数据文件夹挂载到宿主机
*-v /data/elasticsearch/plugins:/usr/share/elasticsearch/plugins:将插件目录挂载到宿主机(需重启)
*-d elasticsearch 后台运行容器,并返回容器ID
*/
创建rabbitmq容器
可修改映射端口号,默认15672
docker pull rabbitmq
docker run -d --name rabbitmq -p 5672:5672 -p 15672:15672 \
-v `pwd`/data:/var/lib/rabbitmq --hostname myRabbit \
-e RABBITMQ_DEFAULT_VHOST=my_vhost \
-e RABBITMQ_DEFAULT_USER=admin \
-e RABBITMQ_DEFAULT_PASS=admin 镜像id \
docker exec -it rabbitmq rabbitmq-plugins enable rabbitmq_management
docker update rabbitmq --restart=always
rabbitmq测试
http://IP:15672
创建nextcloud容器
映射880端口依赖持久化环境,
#没有请安装docker pull mysql
docker pull nextcloud
#规范化默认web应用统一放在/www/wwwroot/域名(可选)中
#mkdir /www/wwwroot/nextcloud
docker run -d \
-v /www/wwwroot/nextcloud/html:/var/www/html \
-v /www/wwwroot/nextcloud/apps:/var/www/html/custom_apps \
-v /www/wwwroot/nextcloud/config:/var/www/html/config \
-v /www/wwwroot/nextcloud/nextcloud/data:/var/www/html/data \
-v /www/wwwroot/nextcloud/themes:/var/www/html/themes \
-p 880:80 \
-d nextcloud
修改/root/nextcloud/config中的config.php,增加以下镜像加速
onlyoffice会有问题再入加allow_local_remote_servers
'appstoreenabled' => true,
'appstoreurl' => 'https://www.orcy.net/ncapps/v1/',
'allow_local_remote_servers' => true,
#修改安全访问,新增
array (
0 => '192.168.31.80:880',
1 => preg_match('/cli/i',php_sapi_name())?'127.0.0.1':$_SERVER['SERVER_NAME'],
),
'onlyoffice' =>
array (
'verify_peer_off' => TRUE,
),
安装nextcloud插件onlyoffice:
docker pull onlyoffice
docker run -i -t -d -p 6060:80 --restart=always \
-v /app/onlyoffice/DocumentServer/logs:/var/log/onlyoffice \
-v /app/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data \
-v /app/onlyoffice/DocumentServer/lib:/var/lib/onlyoffice \
-v /app/onlyoffice/DocumentServer/db:/var/lib/postgresql onlyoffice/documentserver
- 访问
http://ip:6060
,打开如下页面即安装成功。 - 下载onlyoffice插件并配置nextcloud:
- 应用 》office&text 》右上角搜索onlyoffice ,点击下载并启用。
nextcloud测试
http://IP:880
向以下项目致已崇高的敬意
还有啥,一时想不起来......
To be continued...