docker linux centos tomcat session 共享问题

docker linux centos tomcat session 共享问题

37.6 安装一个 session 共享的 tomcat

37.6.0  准备工作

需要一个 curiousby/centos-ssh-root-java-tomcat
需要 commons-pool2-2.2.jar jedis-2.5.2.jar   tomcat-redis-session-manage-tomcat.jar

37.6.1 编辑 tomcat  context.xml

http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!-- The contents of this file will be loaded for each web application -->
<Context>

    <!-- Default set of monitored resources -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource>

    <!-- Uncomment this to disable session persistence across Tomcat restarts -->
    <!--
    <Manager pathname="" />
    -->
    <Manager className="com.orangefunction.tomcat.redissessions.RedisSessionManager" database="0" host="192.168.206.238" maxInactiveInterval="60"  port="6379"/>

    <!-- Uncomment this to enable Comet connection tacking (provides events
         on session expiration as well as webapp lifecycle) -->
    <!--
    <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
    -->
   <Valve className="com.orangefunction.tomcat.redissessions.RedisSessionHandlerValve"/>


</Context>

37.6.2 编辑 dockerfile

############################################
# version:apache-tomcat-7.0.75
# desc : 当前版本安装的7.0.75
############################################

# 设置继承自我们创建的 tools 镜像
FROM curiousby/centos-ssh-root-java-tomcat:original

# 下面是一些创建者的基本信息
MAINTAINER baoyou [email protected]


COPY context.xml /usr/local/tomcat/conf/

COPY commons-pool2-2.2.jar /usr/local/tomcat/lib/

COPY jedis-2.5.2.jar  /usr/local/tomcat/lib/

COPY tomcat-redis-session-manage-tomcat.jar /usr/local/tomcat/lib/

37.6.3 执行命令

docker build -t  curiousby/centos-ssh-root-java-tomcat-session:original  .
docker run -d -v /home/baoyou/soft/centos-ssh-root-java-tomcat-session/jenkins/:/usr/local/tomcat/webapps/  -p 8080:8080 curiousby/centos-ssh-root-java-tomcat-session:original

37.6.4 运行日志

Sending build context to Docker daemon  245.6MB
Step 1/6 : FROM curiousby/centos-ssh-root-java-tomcat:original
 ---> 7dd208c74262
Step 2/6 : MAINTAINER baoyou [email protected]
 ---> Running in c3fa61a42d5d
 ---> 6d26863ed093
Removing intermediate container c3fa61a42d5d
Step 3/6 : COPY context.xml /usr/local/tomcat/conf/
 ---> 69fb214698f6
Removing intermediate container 5c2c3a14da7f
Step 4/6 : COPY commons-pool2-2.2.jar /usr/local/tomcat/lib/
 ---> 3a020dc6a710
Removing intermediate container df207dc60e6f
Step 5/6 : COPY jedis-2.5.2.jar /usr/local/tomcat/lib/
 ---> c88143473183
Removing intermediate container 34323368ef8a
Step 6/6 : COPY tomcat-redis-session-manage-tomcat.jar /usr/local/tomcat/lib/
 ---> fea957b8ad41
Removing intermediate container b715482e29ab
Successfully built fea957b8ad41
Successfully tagged curiousby/centos-ssh-root-java-tomcat-session:original

37.6.5 测试

http://192.168.206.238:8080/jenkins/

 
docker linux centos tomcat session 共享问题
 

捐助开发者 

在兴趣的驱动下,写一个免费的东西,有欣喜,也还有汗水,希望你喜欢我的作品,同时也能支持一下。 当然,有钱捧个钱场(支持支付宝和微信 以及扣扣群),没钱捧个人场,谢谢各位。


docker linux centos tomcat session 共享问题docker linux centos tomcat session 共享问题docker linux centos tomcat session 共享问题
 
 
 谢谢您的赞助,我会做的更好!

相关推荐