制作 leanote docker 镜像 并运行
使用easy_install来安装supervisor
cd /home/zhuyr/leanote
[root@dev leanote]# cat Dockerfile
FROM centos
MAINTAINER zhuyr<304748716@qq.com> # supervisor配置文件路径
ENV SUPERVISORD_CONF=/etc/supervisord.conf
# supervisor临时文件路径(日志文件、sock文件、pid文件)
ENV SUPERVISORD_TMP_CONF=/tmp/supervisor
# supervisor程序块文件路径,即是[program]块
ENV SUPERVISORD_INCLUDE_FILE=/etc/supervisordfile
# web管理界面的IP
ENV SUPERVISORD_WEB_IP=*
# web管理界面的PORT
ENV SUPERVISORD_WEB_PORT=9001
# web管理界面的账号
ENV SUPERVISORD_WEB_ACCOUNT=admin
# web管理界面的密码
ENV SUPERVISORD_WEB_PASSWORD=adminpass RUN mkdir -p ${SUPERVISORD_TMP_CONF}
RUN mkdir -p ${SUPERVISORD_INCLUDE_FILE} RUN yum -y update
RUN yum install -y python-setuptools wget telinit
RUN wget --no-check-certificate https://bootstrap.pypa.io/ez_setup.py -O |python
RUN easy_install supervisor
RUN echo -e "[unix_http_server]\nfile=${SUPERVISORD_TMP_CONF}/supervisor.sock\n[inet_http_server]\nport=${SUPERVISORD_WEB_IP}:${SUPERVISORD_WEB_PORT}\nusername=${SUPERVISORD_WEB_ACCOUNT}\npassword=${SUPERVISORD_WEB_PASSWORD}\n[supervisord]\nlogfile=${SUPERVISORD_TMP_CONF}/supervisord.log\nlogfile_maxbytes=50MB\nlogfile_backups=10\nloglevel=info\npidfile=${SUPERVISORD_TMP_CONF}/supervisord.pid\nnodaemon=false\nminfds=1024\nminprocs=200\n[supervisorctl]\nserverurl=unix://${SUPERVISORD_TMP_CONF}/supervisor.sock\n[include]\nfiles = ${SUPERVISORD_INCLUDE_FILE}/*.ini" > ${SUPERVISORD_CONF} USER root
EXPOSE 22 80 9001 RUN /usr/sbin/init &
RUN /usr/sbin/telinit &
[root@dev leanote]# docker build -t zhuyr/supervisor:1.0 --rm --no-cache . [root@dev leanote]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
zhuyr/supervisor 1.0 e116f6895b37 About a minute ago 236.6 MB
ubuntu 14.04 7c09e61e9035 7 days ago 187.9 MB
## 1.3 下载安装包
[root@test2 leanote]# wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.0.1.tgz
[root@test2 leanote]# wget https://static.axboy.cn/leanote/leanote-linux-amd64-v2.6.1.bin.tar.gz
[root@dev leanote]# cat Dockerfile
# zhuyr/leanote:2.6.1
# with mongodb FROM zhuyr/supervisor:1.0
MAINTAINER zhuyr<304748716@qq.com> ADD init.sh /root/init.sh
#ADD supervisord.conf /etc/supervisor/conf.d/supervisord.conf
ADD supervisord.conf /etc/supervisord.conf
COPY leanote-linux-amd64-v2.6.1.bin.tar.gz /root/
COPY mongodb-linux-x86_64-3.0.1.tgz /root/ RUN mkdir -p /root/db && \
cd /root && \
tar -xvf /root/mongodb-linux-x86_64-3.0.1.tgz && \
tar -xvf /root/leanote-linux-amd64-v2.6.1.bin.tar.gz && \
mv /root/mongodb-linux-x86_64-3.0.1 /root/mongodb && \
mkdir -p /root/conf_bak && \
cp /root/leanote/conf/* /root/conf_bak && \
chmod a+x /root/init.sh && \
chmod a+x /root/leanote/bin/run.sh EXPOSE 9000 CMD ["/usr/bin/supervisord"]
[root@dev leanote]#
[root@dev leanote]# cat supervisord.conf
[supervisord]
nodaemon=true [program:mongodb]
command=/root/mongodb/bin/mongod --dbpath /root/db [program:leanote]
command=/bin/bash -c "/root/init.sh && /root/leanote/bin/run.sh"
[root@dev leanote]# cat init.sh
#!/bin/bash
#set -m # 如果数据库未初始化,则初始化数据库
if [ ! -f "/root/db/already-init-db" ] ; then
touch /root/db/already-init-db
/root/mongodb/bin/mongorestore -h localhost -d leanote --dir /root/leanote/mongodb_backup/leanote_install_data/
fi # 如果配置文件不存在,则复制配置文件
if [ ! -f "/root/leanote/conf/app.conf" ] ; then
cp /root/conf_bak/* /root/leanote/conf/
fi
[root@dev leanote]# ll
总用量 58876
-rw-r--r--. 1 root root 675 3月 7 20:33 Dockerfile
-rw-r--r--. 1 root root 428 3月 7 20:32 init.sh
-rw-r--r--. 1 root root 20717785 3月 7 20:35 leanote-linux-amd64-v2.6.1.bin.tar.gz
-rw-r--r--. 1 root root 39554547 3月 7 20:35 mongodb-linux-x86_64-3.0.1.tgz
-rw-r--r--. 1 root root 197 3月 7 20:31 supervisord.conf
[root@dev leanoteDockerFile]#
[root@dev leanoteDockerFile]# docker build -t zhuyr/leanote:2.6.1 --rm --no-cache . [root@dev leanoteDockerFile]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
zhuyr/leanote 2.4 60896a4094b8 12 seconds ago 477.4 MB
zhuyr/supervisor 1.0 e116f6895b37 15 minutes ago 236.6 MB
ubuntu 14.04 7c09e61e9035 7 days ago 187.9 MB
[root@dev leanoteDockerFile]#
[root@dev leanote]# docker run --name leanote -d -v /leanote/leanotedb:/root/db -v /leanote/conf/:/root/leanote/conf/ -v /leanote/files:/root/leanote/files -p 9000:9000 zhuyr/leanote:2.6.1
[root@test2 leanote]# docker exec -it leanote /bin/bash
[root@33106c3f0054 bin]# pwd
/root/mongodb/bin
[root@33106c3f0054 bin]# ./mongo
>show dbs;
leanote 0.078GB
local 0.078GB
> use leanote;
switched to db leanote
> db.createUser({
... user:'zhuyr',
... pwd:'abc123',
... roles:[{role:'dbOwner',db:'leanote'}]
... }); Successfully added user: {
"user" : "zhuyr",
"roles" : [
{
"role" : "dbOwner",
"db" : "leanote"
}
]
}
> db.auth("zhuyr","abc123");
1
> #查看leanote配置文件
[root@33106c3f0054 leanote]# cd conf/
[root@33106c3f0054 conf]# pwd
/root/leanote/conf
[root@33106c3f0054 conf]# cat app.conf
## 4.问题处理
如果mongodb里的leanote没导入成功,则进入容器重新执行以下命令:
制作 leanote docker 镜像 并运行的更多相关文章
- 制作 leanote docker 镜像
leanote 使用 mongodb 存储数据,如果把 mongodb 单独做成一个镜像,初始化数据时比较麻烦,所以最后还是决定把 mongodb 和 leanote 放到同一个镜像里边. docke ...
- 制作一个docker镜像:mysql-8-x64-linux
因为个人学习需要,为软件系统的虚拟容器化,以下将mysql制作为docker镜像,并记录下详细步骤. 欢迎大家学习交流和转载,同时写作不易,如果各位觉得不错,请点赞支持. 备注:以下代码和文章,欢迎复 ...
- Docker安装Jenkins打包Maven项目为Docker镜像并运行【保姆级图文教学】
一.前言 Jenkins作为CI.CD的先驱者,虽然现在的风头没有Gitlab强了,但是还是老当益壮,很多中小公司还是使用比较广泛的.最近小编经历了一次Jenkins发包,感觉还不错,所以自己学习了一 ...
- 制作seata docker镜像
seata是阿里巴巴的一款开源的分布式事务框架,官方已经支持docker了,但是因为业务的需要,需要自己定制. 制作docker镜像 官方的Dockerfile.下载seata-server-1.1. ...
- 制作zipkin docker镜像
这里使用的zipkin知识基于内存的版本,没有接入外部存储 https://zipkin.io/ https://github.com/openzipkin/zipkin https://github ...
- 制作sentinel docker镜像
在sentinel官方下载jar包即可运行,但是在部署的时候一个一个的启动jar包很不方便,制作成镜像方便部署和管理. 1)直接运行 # 修改端口号,默认是8080 java -jar sentine ...
- Spring Boot 的项目打包成的 JAR 包,制作成 docker 镜像并运行
上一篇:Docker学习(三)docker容器操作 首先把本地的项目打包好,我这里直接把已经打包好的springboot-mybatis-0.0.1-SNAPSHOT.jar包直接上传到linuxmy ...
- Java的jar包构建成docker镜像并运行
结构如下 把jar和Dockerfile放到一个文件,不在一个文件下会报错文件找不到 创建一个构建文件 buildimage.sh vi /home/hanby/buildimage.sh echo ...
- 【玩转开源】制作Docker镜像
做嵌入式方向经常会遇到的一个问题,就是编译环境安装,如果换电脑,再重新安装环境是一个比较费时的事情,这个时候可以自己制作一个Docker镜像,然后把编译环境在Docker镜像里面配置好,以后同步环境就 ...
随机推荐
- curl安装问题--liburl3找不到
问题: 大概就是,liburl3依赖没找到,或版本不对. 解决办法: 我们可以使用purge重新安装之. sudo apt-get purge libcurl3-gnutls sudo apt ins ...
- Android5以后WebView闪退问题
Android4.4开发项目中的webview在Android各个版本运行的飞起,可是项目升级,最低版本适配5.0之后,webview各种闪退问题 真让人头大!!!!!!!!!!!!!!! 啊啊啊啊啊 ...
- git 服务端安装
服务器端创建 git 用户,用来管理 Git 服务,并为 git 用户设置密码 [root@localhost home]# id git id: git:无此用户 [root@localhost h ...
- Shortest Unsorted Continuous Subarray
Given an integer array, you need to find one continuous subarray that if you only sort this subarray ...
- 坦克大战--Java类型
写在前面 Java编译器下载教程(真的良心):https://blog.csdn.net/Haidaiya/article/details/81230636 本项目为本人独自制作,请各位尊 ...
- LC 349. Intersection of Two Arrays
题目描述 Given two arrays, write a function to compute their intersection. Example 1: Input: nums1 = [1, ...
- ~ android与ios的区别
Oracle与Mysql的区别 项目类别 android ios 应用上 可以使用常用的android模拟器,来模拟各种android设备 只能直接使用iphone或ipad进行测试 开发语言 基于L ...
- k8s-搭建 EFK 日志系统
搭建 EFK 日志系统 大家介绍了 Kubernetes 集群中的几种日志收集方案,Kubernetes 中比较流行的日志收集解决方案是 Elasticsearch.Fluentd 和 Kibana( ...
- QQ浏览器、搜狗浏览器等兼容模式下,Asp.NetCore下,Cookie、Session失效问题
原文:QQ浏览器.搜狗浏览器等兼容模式下,Asp.NetCore下,Cookie.Session失效问题 这些狗日的浏览器在兼容模式下,保存Cookie会失败,是因为SameSiteMode默认为La ...
- Typeof() 和 GetType()区别
1.typeof(x)中的x,必须是具体的类名.类型名称等,不可以是变量名称. 2.GetType()方法继承自Object,所以C#中任何对象都具有GetType()方法,它的作用和typeof() ...