一看必會系列:docker tomcat容器測試

來源:本站原創 容器技術 超過365 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.qdxgqk.live/?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
[email protected]:/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

測試文件放這里
[email protected]:/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.qdxgqk.live/ 版權所有。本站文章除注明出處外,皆為作者原創文章,可自由引用,但請注明來源。 禁止全文轉載。
本文鏈接:http://www.qdxgqk.live/?p=3823轉載請注明轉自CCIE那點事
如果喜歡:點此訂閱本站
?
?
萌宠夺宝游戏