docker linux centos tomcat session sharing problem
37.6 Install a session shared tomcat
37.6.0 Preparations
Requires a 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 Editing 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 Editing the dockerfile
############################################ # version:apache-tomcat-7.0.75 # desc : 7.0.75 installed by the current version ############################################ # The settings are inherited from the tools image we created FROM curiousby/centos-ssh-root-java-tomcat:original # Below is some basic information about the creator 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 Execute Commands
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 Run Log
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 Testing
http://192.168.206.238:8080/jenkins/
Donate to developers
Driven by interest, I write 免费
something with joy and sweat. I hope you like my work and can support it at the same time. Of course, if you have money to support a money field (support Alipay, WeChat, and the buckle group), if you have no money to support a personal field, thank you.
Personal homepage : http://knight-black-bob.iteye.com/
Thank you for your sponsorship, I will do better!