一看必会系列:docker tomcat容器测试

来源:本站原创 容器技术 超过102 views围观 0条评论

仓库服务器操作

拉的国内源,原厂源太慢
docker search registry.docker-cn.com/library/tomcat
docker pull registry.docker-cn.com/library/tomcat
docker images

打包推到本地

docker tag registry.docker-cn.com/library/tomcat 192.168.142.130:5000/tomcat:v1
docker images
docker images |grep 5000
docker ps
docker push 192.168.142.130:5000/tomcat:v1
docker images

应用服务器操作

docker pull 192.168.142.130:5000/tomcat:v1
vim /opt/dockerfiles/Dockerfile
FROM 192.168.142.130:5000/tomcat:v1
copy login.jsp /usr/local/tomcat/webapps/

docker build -t jefftomcat:v2 .

docker run -itd -p 808:8080  jefftomcat:v2 /bin/bash

更新源
建议先更新国内源  方式http://www.jdccie.com/?p=3821
apt-get update && apt-get install vim -y

apt-get install vim
cat /proc/version
uname
uname -a
cat /proc/version
sb_reease -a
rb_release
cat /etc/issue  发现版本是debian
apt-get install net-tools
netstat -ntlp    发现端口没起动

cd bin/
./startup.sh    国内源和原厂不一样,不是自己启动,需要手动运行
netstat -ntlp
java -version
root@81128bff7253:/usr/local/tomcat/webapps# !net
netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name   
tcp6       0      0 127.0.0.1:8005          :::*                    LISTEN      438/java           
tcp6       0      0 :::8009                 :::*                    LISTEN      438/java           
tcp6       0      0 :::8080                 :::*                    LISTEN      438/java

测试文件放这里
root@81128bff7253:/usr/local/tomcat/webapps/ROOT/login.jsp

login.jsp内容如下
<%@ page import="java.sql.*" language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>登录界面</title>
</head>
<body>
    <center>
        <h1 style="color:red">登录</h1>
            <form id="indexform" name="indexForm" action="logincheck.jsp" method="post">
                <table border="0">
                    <tr>
                        <td>账号:</td>
                        <td><input type="text" name="username"></td>
                    </tr>
                    <tr>
                        <td>密码:</td>
                        <td><input type="password" name="password">
                        </td>
                    </tr>
                </table>
            <br>
                <input type="submit" value="登录" style="color:#BC8F8F">
            </form>
            <form action="zhuce.jsp">
                <input type="submit" value="注册" style="color:#BC8F8F">
            </form>
    </center>
</body>
</html>

文章出自:CCIE那点事 http://www.jdccie.com/ 版权所有。本站文章除注明出处外,皆为作者原创文章,可自由引用,但请注明来源。 禁止全文转载。
本文链接:http://www.jdccie.com/?p=3823转载请注明转自CCIE那点事
如果喜欢:点此订阅本站
  • 相关文章
  • 为您推荐
  • 各种观点

暂时还木有人评论,坐等沙发!
发表评论

快捷键:Ctrl+Enter