标签 - docker

filebrowser docker    2021-03-17 17:12:27    24    0    0

过程

  1. sudo docker run --name=filebrowser \
  2. -v /data/docker:/srv \
  3. -p 8394:80 \
  4. --privileged --restart unless-stopped \
  5. filebrowser/filebrowser
  • 用上面的脚本先生成容器
  • 进入容器,运行下面的语句
  1. 创建配置数据库:filebrowser -d /database-1.db config init
  2. 设置监听地址:filebrowser -d /database-1.db config set --address 0.0.0.0
  3. 设置监听端口:filebrowser -d /database-1.db config set --port 80
  4. 添加一个用户:filebrowser -d /database-1.db users add root password --perm.admin //其中的root和password分别是用户名和密码,根据自己的需求更改
  5. 设置SSL证书: filebrowser -d /database-1.db config set --cert /srv/hass_config/13.crt --key /srv/hass_config/13.key
  1. cp database.db database-1.db
  2. ./filebrowser -d /database-1.db config set --cert /srv/ssl/13.crt --key /srv/ssl/13.key
  3. rm -rf database.db
  4. mv database-1.db database.db
  • 完成上述语句后,运行下面的进行替换

  • 重启容器

  • 然后可以用 https://domain:8394 来访问了

其他

  • 查看db
  1. ./filebrowser -d /database.db config cat
docker homeassistant    2021-03-16 19:56:13    26    0    0

docker脚本

  1. docker run -d \
  2. --name=home_assistant \
  3. -e TZ="Asia/Shanghai" \
  4. -v /data/docker/hass_config:/config \
  5. -v /data/docker/ssl:/ssl \
  6. --net=host \
  7. --privileged \
  8. --restart unless-stopped \
  9. homeassistant/home-assistant:latest

homeassistant(我的基本配置)

  • configuration.yaml
  1. # Configure a default setup of Home Assistant (frontend, api, etc)
  2. default_config:
  3. # Text to speech
  4. switch:
  5. - platform: command_line
  6. switches:
  7. egg:
  8. command_on: sed -i 's/stop/on/' /config/egg.txt
  9. command_off: sed -i 's/stop/off/' /config/egg.txt
  10. ha_sidebar:
  11. name: 侧边栏管理
  12. icon: mdi:view-list-outline
  13. http:
  14. ssl_certificate: /ssl/13.crt
  15. ssl_key: /ssl/13.key
  16. sonoff:
  17. username: '+8618017300756'
  18. password: '*********'
  19. scan_interval: 60
  20. grace_period: 600
  21. api_region: 'cn'
  22. entity_prefix: True
  23. debug: False
  24. group: !include groups.yaml
  25. automation: !include automations.yaml
  26. script: !include scripts.yaml
  27. scene: !include scenes.yaml
docker portainer    2020-10-20 21:55:25    32    0    1

一、一键安装法

  1. sudo curl -sSL https://get.docker.com | sh

二、其它安装法(略)

三、使用

  1. #下载 Docker 图形化界面 portainer
  2. sudo docker pull portainer/portainer
  3. #创建 portainer 容器
  4. sudo docker volume create portainer_data
  5. #运行 portainer
  6. sudo docker run -d -p 9000:9000 --name portainer --restart always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer
  1. mkdir /opt/portainer/ssl; #将证书文件.key .crt复制到目录中
  2. mkdir /opt/portainer/pub; #将中文压缩包解压到目录中
  3. sudo docker run -d -p 7086:9000 \
  4. --name portainer-ce --restart always \
  5. -v /data/docker/ssl:/certs \
  6. -v /data/docker/portainer/pub:/public \
  7. -v /var/run/docker.sock:/var/run/docker.sock \
  8. -v portainer_data:/data \
  9. portainer/portainer \
  10. --ssl --sslcert /certs/13.crt --sslkey /certs/13.key
  • 在图形化界面中操作更加便利。运行之后在浏览器中输入树莓派IP:9000 进入界面。
  • 首次访问需要设定登录密码。
  • 对于树莓派上的应用,选择 Local 就好。
  • 在控制台可以看到 Docker 的各种资源信息。

四、注

脚本安装docker,换个源会快很多
sudo curl https://get.docker.com/ > ./docker_install.sh

docker 降级    2020-01-20 17:22:49    164    0    0

一、重启群晖后,启动docker容器报错

  1. homeassistant failed: {"message":"cgroups: cannot find cgroup mount destination: unknown"}.
  2. homeassistant failed: {"message":"OCI runtime create failed: container with id exists: 64a896a1ed33c4a925897e7c1c3f0dbcbf9bfa01f3db43fa529fe627d5938e88: unknown"}.

二、偿试了一些方法,无解

  • 卸载docker套件,保留镜像及共享文件夹,重装后问题依旧
  • 重新下载了一个小体积镜像,配置后也无法启动
  • 网上都说是docker版本与linux核心不兼容,这怎么搞啊我也不能升级群晖啊!!!!

三、想到给docker套件降降级

  • 备份原docker的共享文件夹
  • 导出原各个docker容器镜像
  • 旧版本的套件安装包下载: Docker-x64-17.05.0-0400.spk
  • 手动安装docker套件

四、恢复

  • 之前备份的共享文件夹还原到现docker共享文件夹中
  • 导入容器时发现,通过docker套件导入报错
  • ssh进入群晖用命令导入备份的容器镜像
  1. docker import - 000_leanote < 000_leanote.syno.txz
  2. sha256:7ced94f7666933bae89b54b282b0db26952027d31919d4d6c4ed23d5a0e759f1
docker portainer webui    2019-11-09 20:34:24    50    0    1

安装

 
  1. docker run -d --name portainer --restart always \
  2. -p 9123:9000 \
  3. -v /opt/seafile/ssl:/certs \
  4. -v /var/run/docker.sock:/var/run/docker.sock \
  5. -v /opt/portainer/pub:/public \
  6. portainer/portainer --ssl --sslcert /certs/13ua.com.crt --sslkey /certs/13ua.com.key
  • public 为汉化目录
  • certs 为ssl证书目录
 
docker-compose docker seafile onlyoffice    2019-10-21 14:18:42    60    0    0

docker-compose.yml

  1. version: '2.0'
  2. services:
  3. db:
  4. image: mariadb:10.1
  5. container_name: seafile-mysql
  6. environment:
  7. - MYSQL_ROOT_PASSWORD=sl2w71201 # Requested, set the root's password of MySQL service.
  8. - MYSQL_LOG_CONSOLE=true
  9. volumes:
  10. - /opt/seafile-mysql:/var/lib/mysql # Requested, specifies the path to MySQL data persistent store.
  11. networks:
  12. - seafile-net
  13. memcached:
  14. image: memcached:1.5.6
  15. container_name: seafile-memcached
  16. entrypoint: memcached -m 256
  17. networks:
  18. - seafile-net
  19. elasticsearch:
  20. image: seafileltd/elasticsearch-with-ik:5.6.16
  21. container_name: seafile-elasticsearch
  22. environment:
  23. - discovery.type=single-node
  24. - bootstrap.memory_lock=true
  25. - "ES_JAVA_OPTS=-Xms1g -Xmx1g"
  26. ulimits:
  27. memlock:
  28. soft: -1
  29. hard: -1
  30. mem_limit: 2g
  31. volumes:
  32. - /opt/seafile-elasticsearch:/usr/share/elasticsearch/data # Requested, specifies the p
403 seafile docker docker-compose    2019-10-13 16:57:35    40    0    0

问题表现

  • 在docker-compose.yml中seafile使用了443
  • 路由上做了端口转发,443转18443
  • 用‘域名:18443’访问,可以看到登录界面
  • 登录后,跳转到如下页面
    title

修改 /opt/seafile-data/seafile/conf/seahub_settings.py

  1. CSRF_TRUSTED_ORIGINS = ['域名:端口']
  • 注:“['']”别漏了啊!

onlyoffice docker    2019-10-03 18:54:43    21    0    0

你得有docker环境(略)

拉取onlyoffice镜像

  1. docker pull onlyoffice/documentserver:latest

设置ssl

  • 宿主机上建个存放目录
  1. mkdir -pv /opt/onlyoffice/ssl/certs
  • 复制SSL证书文件到目录中
  1. [root@localhost opt]# ll /opt/onlyoffice/ssl/certs
  2. 总用量 8
  3. -rwxr-xr-x. 1 110 114 1980 10 3 17:30 onlyoffice.crt
  4. -rwxr-xr-x. 1 110 114 1679 10 3 17:30 onlyoffice.key
  5. [root@localhost opt]#

启动容器

  1. docker run --net onlyoffice --privileged -i -t -d --restart=always --name onlyoffice \
  2. -p 28443:443 \
  3. -v /opt/onlyoffice/ssl:/var/www/onlyoffice/Data \
  4. -e FORCE_SSL=true -e CERT_FOLDER=/certs/ \
  5. onlyoffice/documentserver

验证服务器是否正常

  1. # 在浏览器输入:
  2. https://域名:28443/welcome
  • 见到下图就说明可以正常合适了
    title
docker    2019-10-02 20:01:47    5    0    0

安装Docker

  • 把yum包更新到最新(不要问我为什么)
  1. [root@localhost ~]# yum update
  2. 已加载插件:fastestmirror, langpacks
  3. Loading mirror speeds from cached hostfile
  4. * base: centos.ustc.edu.cn
  5. * extras: mirrors.aliyun.com
  6. * updates: centos.ustc.edu.cn
  7. 正在解决依赖关系
  8. --> 正在检查事务
  9. ---> 软件包 bind-libs.x86_64.32.9.9.4-61.el7 将被 升级
  10. ---> 软件包 bind-libs.x86_64.32.9.9.4-61.el7_5.1 将被 更新
  11. ---> 软件包 bind-libs-lite.x86_64.32.9.9.4-61.el7 将被 升级
  12. ---> 软件包 bind-libs-lite.x86_64.32.9.9.4-61.el7_5.1 将被 更新
  13. ---> 软件包 bind-license.noarch.32.9.9.4-61.el7 将被 升级
  14. ---> 软件包 bind-license.noarch.32.9.9.4-61.el7_5.1 将被 更新
  15. ...
  16. ...
  17. 验证中 : 32:bind-license-9.9.4-61.el7.noarch 8/8
  18. 更新完毕:
  19. bind-libs.x86_64 32:9.9.4-61.el7_5.1
  20. bind-libs-lite.x86_64 32:9.9.4-61.el7_5.1
  21. bind-license.noarch 32:9.9.4-61.el7_5.1
  22. bind-utils.x86_64 32:9.9.4-61.el7_5.1
  23. 完毕!
  24. [root@localhost ~]#
  • 安装需要的软件包
  1. [root@localhost ~]# yum install -y yum-utils device-mapper-persistent-data lvm2
  2. 已加载插件:fastestmirror, langpacks
  3. Loading mirror speeds from cached hos
error docker    2019-09-12 15:01:19    7    0    0
  • Docker的设计理念是在容器里面不运行后台服务,容器本身就是宿主机上的一个独立的主进程,也可以间接的理解为就是容器里运行服务的应用进程。一个容器的生命周期是围绕这个主进程存在的,所以正确的使用容器方法是将里面的服务运行在前台。

  • 再说到systemd,这个套件已经成为主流Linux发行版(比如CentOS7、Ubuntu14+)默认的服务管理,取代了传统的SystemV风格服务管理。systemd维护系统服务程序,它需要特权去会访问Linux内核。而容器并不是一个完整的操作系统,只有一个文件系统,而且默认启动只是普通用户这样的权限访问Linux内核,也就是没有特权,所以自然就用不了!

  • 因此,请遵守容器设计原则,一个容器里运行一个前台服务!

以特权模式运行容器。

创建容器:

  1. docker run -d -name centos7 --privileged=true centos:7 /usr/sbin/init

进入容器:

  1. docker exec -it centos7 /bin/bash

这样可以使用systemctl启动服务了。

docker seafile centos7 python    2019-09-05 21:57:13    78    0    0

centos7镜像需要安装的一些包包

  1. yum install wget -y
  2. yum install which -y
  3. yum install jre -y
  4. python get-pip.py

点这里下载 - > get-pip.py

官方安装提示

  1. # on CentOS 7
  2. yum -y install epel-release
  3. yum -y install python-imaging MySQL-python python-memcached python-ldap python-urllib3 ffmpeg ffmpeg-devel
  4. pip install pillow moviepy

手动安装时要注意

  • 不能事先 ln -s xxxxx xseafile-server-latest,用rm -rf ./seafile-server-latest把这个软键删除
  • seafile-pro-6.3.7 5000许可这个版本显示头像似乎有问题

    rm -rf /opt/seafile/seahub-data/avatars
    mkdir /opt/seafile/seahub-data/avatars
  • 使用163企业邮箱

    1. EMAIL_USE_TLS = False
    2. EMAIL_HOST = 'smtp.ym.163.com'
    3. EMAIL_HOST_USER = 'admin@13ua.com'
    4. EMAIL_HOST_PASSWORD = 'password'
    5. EMAIL_PORT = '25'
    6. DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
    7. SERVER_EMAIL = EMAIL_HOST_USER
  • 启用onlyoffice

    1. #Enable Only Office
    2. ENABLE_ONLYOFFICE = True
    3. VERIFY_ONLYOFFICE_CERTIFICATE = True
    4. ONLYOFFICE_APIJS_URL = 'https://13ua.com:8888/web-apps/apps/api/documents/api.js'
    5. ONLYOFFICE_FILE_EXTENSION = ('do
升级 docker    2019-08-30 07:51:43    25    0    0

手贱真可怕,升级有风险

2019-08-27看到群晖系统有红出现,强迫症发作,点之
然后。。。。。。。
docker所有容器无法启动

使用了百度来的所有方法

无解

自己动手能救多少是多少

  • 导出所有容器(包括配置、内容)
  • 备份docker共享目录
  • 卸载docker套件
  • 重装docker套件
  • 导入之前备份的目录及容器
  • 偿试启动
  • 成功启动了70%的容器

docker leanote    2019-03-24 13:08:17    87    1    1

我的使用环境

  • 黑群晖
  • docker套件

安装步骤

  1. 下载并启动centos7.X镜像,生成容器
  2. 容器内基础服务安装
  3. 下载解压配置leanote
  4. 下载解压配置mongoDB
  5. 自起动配置

启动镜像生成容器

  • 配置容器的端口:44422用于ssh,44490用于访问
  • 图片标题
  • 卷配置:docker/leanote => /home/bak

容器内基础服务安装

  • 打开ssh(可跳过不看这步)
  1. yum install openssh-server -y
  2. vim /etc/ssh/sshd_config
  3. # 修改 Port 44422
  4. # 修改 PermitRootLogin yes
  5. systemctl enable sshd
  6. systemctl start sshd
  • 安装wget,vim
  1. yum install wget -y
  2. yum install vim -y

下载解压配置leanote 和 mongoDB

  1. #进入目标目录
  2. cd /home
  3. #下载leanote
  4. wget https://sourceforge.net/projects/leanote-bin/files/2.6.1/leanote-linux-amd64-v2.6.1.bin.tar.gz
  5. #解压
  6. tar -xzvf leanote-linux-amd64-v2.6.1.bin.tar.gz
  7. #下载mongoDB
  8. wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.0.1.tgz
  9. #解压
  10. tar -xzvf mongodb-linux-x86_64-3.0.1.tgz
  11. #改目录名为mongodb
  12. mv mongodb-linux-x86_64-3.0.1 mongodb
  13. #删除安装包
  14. rm -f leanote-linux-amd64-v2.6.1.bin.tar.gz
  15. rm -f mongodb-linux-x86_64-3.0.1.tgz
  1. #开始进行配置
  2. export PATH=$PATH:/home/mongodb/bin
  3. export LC_ALL=C
  4. #启动数据库
  5. mongod
docker    2019-03-24 13:08:17    26    0    0
在主机上执行docker容器里面的脚本命令: `docker exec -i 容器ID/容器名 命令` 如: `docker exec -i 000-leanote bash /home/bak/backup.sh`
群晖 docker seafile 私有云    2019-03-24 13:07:37    445    0    6

title

没有废话,就直接记录一下安装吧!虽然安装完了也没什么用,呵呵。

准备工作

  1. 下载pro包备用:https://download.seafile.com/d/6e5297246c/?p=%2Fpro

  2. docker (略)

  3. seafile:

  1. docker pull xama/docker-seafile-pro
  2. docker run -d \
  3. --name=seafile \
  4. --network=host \
  5. -v <path/dir>:/seafile \
  6. xama/docker-seafile-pro
  1. onlyoffice:
  1. docker pull onlyoffice/documentserver
  2. docker run -i -t -d \
  3. --name=onlyoffice \
  4. -p 8888:80 \
  5. onlyoffice/documentserver
  1. 验证onlyoffice是否成功: http{s}://{your Seafile Server's domain or IP}:{port}/welcome

  2. 容器外的 MariaDB 10 (略)

安装seafile-pro

  1. 进入容器
  1. docker exec -if seafile /bin/bash
  1. 进入seafile目录,解压pro包,进入pro目录
  1. cd /seafile
  2. tar -zxf seafile-pro-server_6.3.7_x86-64.tar.gz
  3. cd /seafile-pro-server_6.3.7
  1. 运行代mysql的安装脚本
  1. ./setup-seafile-mysql.sh
  1. 一路按提示安装(略),其中要用到连接容器外的数据库,就是前面提到的MariaDB 10,地址:127.0.0.1,端口:3307 用户root的密码:xxxxx(按实际情况填写吧!)

  2. 慢慢等到数据库安装完成吧。。。。。等。。。待。

  3. 运行seafile启动脚本,并按提示填写管理员帐号信息。

  1. ./seafile.sh start
  2. ./seafile.sh resta