受https://gitee.com/gsls200808/JrebelLicenseServerforJava 作者的启发,决定在他的基础上进行改进,并制作一个docker版本的授权服务器。目前Docker版的授权服务器已经制作完成,并放在了Docker Hub的仓库中,地址是:https://hub.docker.com/r/qinjiangbo/jrebel-server/ ,里面有详细的使用说明,但是今天本文还是一步一步讲一下如何使用docker来打造一个JRebel的授权服务器。
下载Docker镜像 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 $ docker pull qinjiangbo/jrebel-server Using default tag: latest latest: Pulling from qinjiangbo/jrebel-server 5040bd298390: Already exists fce5728aad85: Already exists 76610ec20bf5: Already exists 60170fec2151: Already exists e98f73de8f0d: Already exists 11f7af24ed9c: Already exists 2cf014724202: Already exists 4bc402a00dfe: Already exists 12083eb63e6e: Pull complete f22c128afefa: Pull complete 92d84e0aeed2: Pull complete 37d91e27dd7b: Pull complete Digest: sha256:253d0cd8892aa4e897c7766a00b1250295fef2383649bcec2a3874905341f3b3 Status: Downloaded newer image for qinjiangbo/jrebel-server:latest
使用docker images
查看列表得到如下结果:
1 2 3 4 5 6 7 8 9 10 docker images REPOSITORY TAG IMAGE ID CREATED SIZE qinjiangbo/jrebel-server latest dbd72510c946 35 minutes ago 653MB qinjiangbo/idea-license-server latest b185c20c5886 2 months ago 120MB ubuntu latest 00fd29ccc6f1 3 months ago 111MB sshd_centos latest f0560ea85754 5 months ago 221MB nginx latest 1e5ab59102ce 5 months ago 108MB gitlab/gitlab-ce latest 453d64ae84c7 5 months ago 1.28GB centos latest 196e0ce0c9fb 6 months ago 197MB java 8 d23bdf5b1b1b 14 months ago 643MB
我们可以看到jrebel-server
的镜像ID是dbd72510c946
。接下来我们就来启动容器。
启动容器 1 2 3 4 5 $ docker run -d -p 8081:8081 dbd7 c15ebe41bd8b089e2068c69bc1bf5f24b8003722dfdfcfbb547ba29e190d9070 $ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES c15ebe41bd8b dbd7 "/usr/local/sbin/r..." 2 seconds ago Up 6 seconds 0.0.0.0:8081->8081/tcp hungry_kalam
可以看到容器启动成功了。
访问页面查看具体的激活指南 访问网页http://localhost:8081/ ,可以看到如下页面:
总结 本文并没有讲解如何使用Dockerfile来构造一个Docker镜像。对于有些想学习Dockerfile的同学,那么我还是附上本镜像的Dockerfile吧:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 FROM java:8 MAINTAINER qinjiangbo<[email protected] > ADD JrebelLicenseServerforJava-1.0-SNAPSHOT-jar-with-dependencies.jar jrebel-server.jar ADD IntelliJIDEALicenseServer.html /html/IntelliJIDEALicenseServer.html ADD run.sh /usr/local /sbin/run.sh RUN chmod 755 /usr/local /sbin/run.sh EXPOSE 8081 CMD ["/usr/local/sbin/run.sh" ]
如果觉得不错,欢迎大家给我的镜像多多点个Star哈~