序文
TomcatのWebプロジェクトの展開は、その上のwebappsディレクトリに戦争のパッケージは非常に便利です。迅速Tomcatの環境を構築Benpian使用ドッキングウィンドウ
Tomcatのミラーをダウンロード
Tomcatのミラーの最新の公式バージョンを引いて
[root@yoyo ~]# docker pull tomcat
Using default tag: latest
latest: Pulling from library/tomcat
6f2f362378c5: Pull complete
494c27a8a6b8: Pull complete
7596bb83081b: Pull complete
372744b62d49: Pull complete
fb72767f9beb: Pull complete
3fe571af508a: Pull complete
3e6725074325: Pull complete
9ffd5dadda90: Pull complete
4e051c2969b0: Pull complete
b326a8316680: Pull complete
Digest: sha256:cea26a23e1ebdbebdddde1e02a10e655b0b386d8de6002301a037a08be87a12f
Status: Downloaded newer image for tomcat:latest
ダウンロードした画像ファイルを表示します
[root@yoyo ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centos v7.5 254d4dfe9df7 3 days ago 200MB
tomcat latest 5377fd8533c3 2 weeks ago 506MB
mysql 5.6 3ed1080b793f 2 weeks ago 256MB
mysql 5.7 a1aa4f76fab9 2 weeks ago 373MB
centos/python-36-centos7 latest b8d15efaa8ec 2 months ago 651MB
centos centos7.5.1804 cf49811e3cdb 3 months ago 200MB
ubuntu 15.10 9b9cb95443b5 2 years ago 137MB
training/webapp latest 6fae60ef3446 4 years ago 349MB
ファイル名を指定して実行コンテナ
Tomcatコンテナを実行するドッキングウィンドウの実行を使用します
- --name yoyotomcat 容器重命名yoyotomcat
- -p 8090:8080は、コンテナ8090ポートのホストポート8080にマッピングされています
- -v〜/ヨーヨー/ tomcatに/ webappsに/ジェンキンス:は/ usr / local / tomcatに/ webappsに/ジェンキンスコンテナは/ usr / local / tomcatに/ webappsに/ジェンキンスディレクトリがマシンに搭載されている〜/ヨーヨー/ tomcatに/ webappsに/ジェンキンス
- -dぶら下げ背景
ドッキングウィンドウの実行--name yoyotomcat -p 8090:8080 -v〜/ヨーヨー/ tomcatに/ webappsに/ジェンキンス:は/ usr / local / tomcatに/ webappsに/ジェンキンス-d tomcatに
正常に実行コンテナのドッキングウィンドウのPSの表示を実行した後
[root@yoyo jenkins]# docker run --name yoyotomcat -p 8090:8080 -v ~/yoyo/tomcat/webapps/jenkins:/usr/local/tomcat/webapps/jenkins -d tomcat
[root@yoyo jenkins]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1d07763a6eaa tomcat "catalina.sh run" 15 minutes ago Up 7 minutes 0.0.0.0:8090->8080/tcp yoyotomcat
643c1f7c970c mysql:5.7 "docker-entrypoint.s…" 8 hours ago Up 27 minutes 33060/tcp, 0.0.0.0:3309->3306/tcp yoyomysql
37a3b50d151c mysql:5.6 "docker-entrypoint.s…" 25 hours ago Up 26 minutes 0.0.0.0:3308->3306/tcp mymysql
[root@yoyo jenkins]#
あなたがバックグラウンドで開くように、ポート8090をアリクラウドサーバーを使用して、そのブラウザでhttpている場合:// IPホスト:8090は、Tomcatにホームページにアクセスすることができます
戦争のパッケージを展開します
Tomcatの環境はつまり、は/ usr / local / tomcatに/ webappsに、その上のTomcatのwebappsディレクトリに、次の戦争のパッケージを展開してきました 。
開始時間の前には、は/ usr / local / tomcatに/ webappsに/ジェンキンスディレクトリがマシンに搭載されている〜/ヨーヨー/ Tomcatのwebappsに// /ジェンキンスディレクトリ。
ちょうどそれにジェンキンスディレクトリを置くjenkins.warダウンロード
- 〜/ヨーヨー/ tomcatに/ webappsに/ジェンキンス/ディレクトリにcd
- wgetのダウンロードjenkins.war
- 解凍jenkins.war -xvf瓶
[root@yoyo jenkins]# cd ~/yoyo/tomcat/webapps/jenkins/
[root@yoyo jenkins]# wget http://mirrors.jenkins-ci.org/war/latest/jenkins.war
--2019-06-30 19:40:15-- http://mirrors.jenkins-ci.org/war/latest/jenkins.war
Resolving mirrors.jenkins-ci.org (mirrors.jenkins-ci.org)... 52.202.51.185
Connecting to mirrors.jenkins-ci.org (mirrors.jenkins-ci.org)|52.202.51.185|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://mirrors.tuna.tsinghua.edu.cn/jenkins/war/2.182/jenkins.war [following]
--2019-06-30 19:40:16-- http://mirrors.tuna.tsinghua.edu.cn/jenkins/war/2.182/jenkins.war
Resolving mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 101.6.8.193, 2402:f000:1:408:8100::1
Connecting to mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)|101.6.8.193|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 77565765 (74M) [application/java-archive]
Saving to: ‘jenkins.war’
100%[=====================================================================================================================>] 77,565,765 12.1MB/s in 5.1s
2019-06-30 19:40:22 (14.4 MB/s) - ‘jenkins.war’ saved [77565765/77565765]
[root@yoyo jenkins]# jar -xvf jenkins.war
解凍後のディレクトリ
[root@yoyo jenkins]# ll
total 78212
drwxr-xr-x 3 root root 4096 Jun 23 20:22 bootstrap
-rw-r--r-- 1 root root 1946 Feb 7 12:49 ColorFormatter.class
drwxr-xr-x 5 root root 4096 Jun 23 20:22 css
-rw-r--r-- 1 root root 1544 Jun 23 20:18 dc-license.txt
drwxr-xr-x 2 root root 4096 Jun 23 20:22 executable
-rw-r--r-- 1 root root 17542 Jun 23 20:18 favicon.ico
drwxr-xr-x 12 root root 4096 Jun 23 20:22 help
drwxr-xr-x 6 root root 4096 Jun 23 20:22 images
-rw-r--r-- 1 root root 77565765 Jun 24 11:22 jenkins.war
-rw-r--r-- 1 root root 1674 Feb 7 12:49 JNLPMain.class
drwxr-xr-x 2 root root 4096 Jun 23 20:22 jsbundles
-rw-r--r-- 1 root root 862 Feb 7 12:49 LogFileOutputStream$1.class
-rw-r--r-- 1 root root 636 Feb 7 12:49 LogFileOutputStream$2.class
-rw-r--r-- 1 root root 2240 Feb 7 12:49 LogFileOutputStream.class
-rw-r--r-- 1 root root 20730 Feb 7 12:49 Main.class
-rw-r--r-- 1 root root 1048 Feb 7 12:49 MainDialog$1$1.class
-rw-r--r-- 1 root root 1067 Feb 7 12:49 MainDialog$1.class
-rw-r--r-- 1 root root 2633 Feb 7 12:49 MainDialog.class
-rw-r--r-- 1 root root 512 Feb 7 12:49 Main$FileAndDescription.class
drwxr-xr-x 3 root root 4096 Jun 30 19:22 META-INF
-rw-r--r-- 1 root root 71 Jun 23 20:18 robots.txt
drwxr-xr-x 3 root root 4096 Jun 23 20:22 scripts
drwxr-xr-x 7 root root 4096 Jun 23 20:22 WEB-INF
-rw-r--r-- 1 root root 2390099 May 12 15:50 winstone.jar
[root@yoyo jenkins]#
そして、それがかかるだろうにTomcatコンテナを再起動します
ドッキングウィンドウの再起動yoyotomcat
アクセスジェンキンス
アクセスアドレスブラウザーを入力します。http://ホストIP:8090 /ジェンキンスは、メインページにアクセスすることができ