部署Nginx
[root@iZwz9a69mvjujb826ezp71Z ~]
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
nginx Official build of Nginx. 17536 [OK]
linuxserver/nginx An Nginx container, brought to you by LinuxS… 178
bitnami/nginx Bitnami nginx Docker Image 141 [OK]
ubuntu/nginx Nginx, a high-performance reverse proxy & we… 63
bitnami/nginx-ingress-controller Bitnami Docker Image for NGINX Ingress Contr… 20 [OK]
rancher/nginx-ingress-controller 11
webdevops/nginx Nginx container 10 [OK]
ibmcom/nginx-ingress-controller Docker Image for IBM Cloud Private-CE (Commu… 4
bitnami/nginx-ldap-auth-daemon 3
bitnami/nginx-exporter 3
vmware/nginx 2
rancher/nginx-ingress-controller-defaultbackend 2
rapidfort/nginx RapidFort optimized, hardened image for NGINX 2
kasmweb/nginx An Nginx image based off nginx:alpine and in… 2
rancher/nginx 2
bitnami/nginx-intel 1
wallarm/nginx-ingress-controller Kubernetes Ingress Controller with Wallarm e… 1
vmware/nginx-photon 1
rancher/nginx-conf 0
rapidfort/nginx-ib RapidFort optimized, hardened image for NGIN… 0
ibmcom/nginx-ingress-controller-ppc64le Docker Image for IBM Cloud Private-CE (Commu… 0
rancher/nginx-ssl 0
continuumio/nginx-ingress-ws 0
rancher/nginx-ingress-controller-amd64 0
ibmcom/nginx-ppc64le Docker image for nginx-ppc64le 0
[root@iZwz9a69mvjujb826ezp71Z ~]
Using default tag: latest
latest: Pulling from library/nginx
a2abf6c4d29d: Pull complete
a9edb18cadd1: Pull complete
589b7251471a: Pull complete
186b1aaa4aa6: Pull complete
b4df32aa5a72: Pull complete
a0bcbecc962e: Pull complete
Digest: sha256:0d17b565c37bcbd895e9d92315a05c1c3c9a29f762b011a10c54a66cd53c9b31
Status: Downloaded newer image for nginx:latest
docker.io/library/nginx:latest
[root@iZwz9a69mvjujb826ezp71Z ~]
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest 605c77e624dd 9 months ago 141MB
centos latest 5d0da3dc9764 13 months ago 231MB
[root@iZwz9a69mvjujb826ezp71Z ~]
fc4b4681cc23c4ab61e9498191c4a2df8338cdc460cd6f3832a6f487c0ea622e
[root@iZwz9a69mvjujb826ezp71Z ~]
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
fc4b4681cc23 nginx "/docker-entrypoint.…" 7 seconds ago Up 5 seconds 0.0.0.0:3344->80/tcp nginx01
[root@iZwz9a69mvjujb826ezp71Z ~]
- 查看是否运行成功
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/802ec5c14489efdc83891450941d0384.png)
- 进入到容器中查看
[root@iZwz9a69mvjujb826ezp71Z ~]
root@8b25ee190c6c:/
bin dev docker-entrypoint.sh home lib64 mnt proc run srv tmp var
boot docker-entrypoint.d etc lib media opt root sbin sys usr
root@8b25ee190c6c:/
root@8b25ee190c6c:/usr/share/nginx/html
50x.html index.html
root@8b25ee190c6c:/
root@8b25ee190c6c:/etc/nginx
conf.d fastcgi_params mime.types modules nginx.conf scgi_params uwsgi_params
root@8b25ee190c6c:/etc/nginx
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
include /etc/nginx/conf.d/*.conf;
}
root@7f93e0a9e5a6:/etc
root@7f93e0a9e5a6:/var/log/nginx
access.log error.log
- 重新启动一个nginx,将配置文件夹、静态资源文件夹、日志文件夹挂载出来
[root@iZwz9a69mvjujb826ezp71Z nginx]
- 登录网站验证
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/de4156f95d27509b426ea9f2ff36d7a9.png)
部署Tomcat
- 官方运行建议 docker run -it --rm -p 8888:8080 tomcat:9.0
- 我们之前的启动都是后台,停止容器之后,容器还是可以查到,而docker run -it -rm,一般用来测试,用完就删除
[root@iZwz9a69mvjujb826ezp71Z ~]
Unable to find image 'tomcat:9.0' locally
9.0: Pulling from library/tomcat
0e29546d541c: Pull complete
9b829c73b52b: Pull complete
cb5b7ae36172: Pull complete
6494e4811622: Pull complete
668f6fcc5fa5: Pull complete
dc120c3e0290: Pull complete
8f7c0eebb7b1: Pull complete
77b694f83996: Pull complete
7662046c36cb: Pull complete
b93639122cb4: Pull complete
Digest: sha256:cd96d4f7d3f5fc4d3bc1622ec678207087b8215d55021a607ecaefba80b403ea
Status: Downloaded newer image for tomcat:9.0
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/local/openjdk-11
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Using CATALINA_OPTS:
NOTE: Picked up JDK_JAVA_OPTIONS: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
18-Oct-2022 14:51:40.604 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version name: Apache Tomcat/9.0.56
18-Oct-2022 14:51:40.613 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Dec 2 2021 14:30:07 UTC
18-Oct-2022 14:51:40.614 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version number: 9.0.56.0
18-Oct-2022 14:51:40.616 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux
18-Oct-2022 14:51:40.617 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 4.19.34-11.al7.x86_64
18-Oct-2022 14:51:40.617 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
18-Oct-2022 14:51:40.619 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /usr/local/openjdk-11
18-Oct-2022 14:51:40.620 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 11.0.13+8
18-Oct-2022 14:51:40.620 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
18-Oct-2022 14:51:40.621 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /usr/local/tomcat
18-Oct-2022 14:51:40.622 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /usr/local/tomcat
18-Oct-2022 14:51:40.654 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.lang=ALL-UNNAMED
18-Oct-2022 14:51:40.655 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.io=ALL-UNNAMED
18-Oct-2022 14:51:40.655 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.util=ALL-UNNAMED
18-Oct-2022 14:51:40.656 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.util.concurrent=ALL-UNNAMED
18-Oct-2022 14:51:40.657 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
18-Oct-2022 14:51:40.657 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties
18-Oct-2022 14:51:40.658 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
18-Oct-2022 14:51:40.658 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
18-Oct-2022 14:51:40.660 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
18-Oct-2022 14:51:40.660 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
18-Oct-2022 14:51:40.660 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
18-Oct-2022 14:51:40.661 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/usr/local/tomcat
18-Oct-2022 14:51:40.663 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/usr/local/tomcat
18-Oct-2022 14:51:40.663 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/usr/local/tomcat/temp
18-Oct-2022 14:51:40.707 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded Apache Tomcat Native library [1.2.31] using APR version [1.7.0].
18-Oct-2022 14:51:40.709 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true], UDS [true].
18-Oct-2022 14:51:40.710 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
18-Oct-2022 14:51:40.762 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized [OpenSSL 1.1.1k 25 Mar 2021]
18-Oct-2022 14:51:41.852 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
18-Oct-2022 14:51:41.934 INFO [main] org.apache.catalina.startup.Catalina.load Server initialization in [1976] milliseconds
18-Oct-2022 14:51:42.193 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
18-Oct-2022 14:51:42.195 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/9.0.56]
18-Oct-2022 14:51:42.247 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
18-Oct-2022 14:51:42.293 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in [356] milliseconds
^C18-Oct-2022 14:52:12.582 INFO [Thread-2] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-8080"]
18-Oct-2022 14:52:12.602 INFO [Thread-2] org.apache.catalina.core.StandardService.stopInternal Stopping service [Catalina]
18-Oct-2022 14:52:12.609 INFO [Thread-2] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["http-nio-8080"]
18-Oct-2022 14:52:12.617 INFO [Thread-2] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["http-nio-8080"]
[root@iZwz9a69mvjujb826ezp71Z ~]
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
fc4b4681cc23 nginx "/docker-entrypoint.…" 30 minutes ago Up 30 minutes 0.0.0.0:3344->80/tcp nginx01
[root@iZwz9a69mvjujb826ezp71Z ~]
[root@iZwz9a69mvjujb826ezp71Z ~]
Using default tag: latest
latest: Pulling from library/tomcat
0e29546d541c: Already exists
9b829c73b52b: Already exists
cb5b7ae36172: Already exists
6494e4811622: Already exists
668f6fcc5fa5: Already exists
dc120c3e0290: Already exists
8f7c0eebb7b1: Already exists
77b694f83996: Already exists
0f611256ec3a: Pull complete
4f25def12f23: Pull complete
Digest: sha256:9dee185c3b161cdfede1f5e35e8b56ebc9de88ed3a79526939701f3537a52324
Status: Downloaded newer image for tomcat:latest
docker.io/library/tomcat:latest
[root@iZwz9a69mvjujb826ezp71Z ~]
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest 605c77e624dd 9 months ago 141MB
tomcat 9.0 b8e65a4d736d 9 months ago 680MB
tomcat latest fb5657adc892 9 months ago 680MB
centos latest 5d0da3dc9764 13 months ago 231MB
[root@iZwz9a69mvjujb826ezp71Z ~]
96ccd7b2ce91f7226fbe20d078463f2ecc2503420d44f919fd382b2871489ac6
[root@iZwz9a69mvjujb826ezp71Z ~]
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
96ccd7b2ce91 tomcat "catalina.sh run" 14 seconds ago Up 12 seconds 0.0.0.0:3344->8080/tcp tomcat01
- 运行成功,访问下3344端口,发现部署成功,但是404
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/e19c6df742246bb92e40e0e3e2159217.png)
- 原因:docker官方的tomcat是阉割的,进入容器查看
[root@iZwz9a69mvjujb826ezp71Z ~]
root@96ccd7b2ce91:/usr/local/tomcat
BUILDING.txt LICENSE README.md RUNNING.txt conf logs temp webapps.dist
CONTRIBUTING.md NOTICE RELEASE-NOTES bin lib native-jni-lib webapps work
root@96ccd7b2ce91:/usr/local/tomcat
root@96ccd7b2ce91:/usr/local/tomcat/webapps
root@96ccd7b2ce91:/usr/local/tomcat/webapps
root@96ccd7b2ce91:/usr/local/tomcat/webapps
root@96ccd7b2ce91:/usr/local/tomcat
root@96ccd7b2ce91:/usr/local/tomcat/webapps.dist
ROOT docs examples host-manager manager
root@96ccd7b2ce91:/usr/local/tomcat/webapps.dist
root@96ccd7b2ce91:/usr/local/tomcat/webapps.dist
root@96ccd7b2ce91:/usr/local/tomcat
root@96ccd7b2ce91:/usr/local/tomcat
root@96ccd7b2ce91:/usr/local/tomcat/webapps
ROOT docs examples host-manager manager
- 刷新界面,发现不是404了
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/88508433fdb69506b88a65daee780810.png)
部署ES
- es暴露的端口多
- es十分耗内存
- es的数据一般需要放置到安全目录!挂载
- –net somenetwork ? 网络配置
- 运行命令
docker run -d --name elasticsearch --net somenetwork -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch:tag
部署MySQL
- 思考:MySQL的数据持久化的问题
- 官方启动命令:docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag
[root@VM-0-10-centos ~]
5.7: Pulling from library/mysql
72a69066d2fe: Pull complete
93619dbc5b36: Pull complete
99da31dd6142: Pull complete
626033c43d70: Pull complete
37d5d7efb64e: Pull complete
ac563158d721: Pull complete
d2ba16033dad: Pull complete
0ceb82207cd7: Pull complete
37f2405cae96: Pull complete
e2482e017e53: Pull complete
70deed891d42: Pull complete
Digest: sha256:f2ad209efe9c67104167fc609cca6973c8422939491c9345270175a300419f94
Status: Downloaded newer image for mysql:5.7
docker.io/library/mysql:5.7
[root@VM-0-10-centos ~]
2022-10-22 11:42:56+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.36-1debian10 started.
2022-10-22 11:42:56+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2022-10-22 11:42:56+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.36-1debian10 started.
2022-10-22 11:42:56+00:00 [Note] [Entrypoint]: Initializing database files
mysqld: Out of memory (Needed 4294967200 bytes)
......
2022-10-22T11:43:06.614841Z 0 [Note] Event Scheduler: Loaded 0 events
2022-10-22T11:43:06.615231Z 0 [Note] mysqld: ready for connections.
Version: '5.7.36' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL)
[root@VM-0-10-centos ~]
[root@VM-0-10-centos data]
auto.cnf client-cert.pem ibdata1 ibtmp1 private_key.pem server-key.pem
ca-key.pem client-key.pem ib_logfile0 mysql public_key.pem sys
ca.pem ib_buffer_pool ib_logfile1 performance_schema server-cert.pem
- 测试:用GUI工具远程连接MySQL之后创建一个test库
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/ee6cc8e3e5ebab8003f3cedf40a0e850.png)
- 回到服务器上查看/home/data文件夹
[root@VM-0-10-centos data]
auto.cnf client-cert.pem ibdata1 ibtmp1 private_key.pem server-key.pem
ca-key.pem client-key.pem ib_logfile0 mysql public_key.pem sys
ca.pem ib_buffer_pool ib_logfile1 performance_schema server-cert.pem test
[root@VM-0-10-centos data]
mysql01
[root@VM-0-10-centos data]
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[root@VM-0-10-centos data]
auto.cnf client-cert.pem ibdata1 ibtmp1 private_key.pem server-key.pem
ca-key.pem client-key.pem ib_logfile0 mysql public_key.pem sys
ca.pem ib_buffer_pool ib_logfile1 performance_schema server-cert.pem test
构建自己的centOS
[root@VM-0-10-centos ~]
[root@VM-0-10-centos home]
data docker-test-volume mysql
[root@VM-0-10-centos home]
[root@VM-0-10-centos home]
[root@VM-0-10-centos home]
data dockerfile docker-test-volume mysql
[root@VM-0-10-centos home]
[root@VM-0-10-centos dockerfile]
[root@VM-0-10-centos dockerfile]
FROM centos:7
MAINTAINER suanbai<76417647@qq.com>
ENV MYPATH /usr/local
WORKDIR $MYPATH
RUN yum -y install vim
RUN yum -y install net-tools
EXPOSE 80
CMD echo $MYPATH
CMD echo "----end----"
CMD /bin/bash
[root@VM-0-10-centos dockerfile]
Sending build context to Docker daemon 2.048kB
Step 1/10 : FROM centos
---> 5d0da3dc9764
Step 2/10 : MAINTAINER suanbai<76417647@qq.com>
---> Running in bdd6ddb7ed00
Removing intermediate container bdd6ddb7ed00
---> e1c11a680505
Step 3/10 : ENV MYPATH /usr/local
---> Running in 2226c278e873
Removing intermediate container 2226c278e873
---> 3498e2e43758
Step 4/10 : WORKDIR $ MYPATH
---> Running in 5af02223ab78
Removing intermediate container 5af02223ab78
---> e2287f1dc69e
Step 5/10 : RUN yum -y install vim
---> Running in a96b6819d273
Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
CentOS Linux 8 - AppStream 73 B/s | 38 B 00:00
The command '/bin/sh -c yum -y install vim' returned a non-zero code: 1
[root@VM-0-10-centos dockerfile]
REPOSITORY TAG IMAGE ID CREATED SIZE
<none> <none> e2287f1dc69e About a minute ago 231MB
sunbai/centos 1.0 5571c282f543 7 hours ago 231MB
nginx latest 605c77e624dd 9 months ago 141MB
mysql 5.7 c20987f18b13 10 months ago 448MB
centos latest 5d0da3dc9764 13 months ago 231MB
[root@VM-0-10-centos dockerfile]
[root@VM-0-10-centos dockerfile]
Sending build context to Docker daemon 2.048kB
Step 1/10 : FROM centos:7
7: Pulling from library/centos
2d473b07cdd5: Pull complete
Digest: sha256:9d4bcbbb213dfd745b58be38b13b996ebb5ac315fe75711bd618426a630e0987
Status: Downloaded newer image for centos:7
---> eeb6ee3f44bd
Step 2/10 : MAINTAINER suanbai<76417647@qq.com>
---> Running in 1b92bb747079
Removing intermediate container 1b92bb747079
---> 1cc0d4f06453
Step 3/10 : ENV MYPATH /usr/local
---> Running in 7754179a8c48
Removing intermediate container 7754179a8c48
---> d18e2e898aee
Step 4/10 : WORKDIR $ MYPATH
---> Running in 7ffdc5253440
Removing intermediate container 7ffdc5253440
---> b430a2aa285b
Step 5/10 : RUN yum -y install vim
---> Running in b83f42ac8d51
Loaded plugins: fastestmirror, ovl
Determining fastest mirrors
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package vim-enhanced.x86_64 2:7.4.629-8.el7_9 will be installed
--> Processing Dependency: vim-common = 2:7.4.629-8.el7_9 for package: 2:vim-enhanced-7.4.629-8.el7_9.x86_64
--> Processing Dependency: which for package: 2:vim-enhanced-7.4.629-8.el7_9.x86_64
--> Processing Dependency: perl(:MODULE_COMPAT_5.16.3) for package: 2:vim-enhanced-7.4.629-8.el7_9.x86_64
--> Processing Dependency: libperl.so()(64bit) for package: 2:vim-enhanced-7.4.629-8.el7_9.x86_64
--> Processing Dependency: libgpm.so.2()(64bit) for package: 2:vim-enhanced-7.4.629-8.el7_9.x86_64
--> Running transaction check
---> Package gpm-libs.x86_64 0:1.20.7-6.el7 will be installed
---> Package perl.x86_64 4:5.16.3-299.el7_9 will be installed
--> Processing Dependency: perl(Socket) >= 1.3 for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(Scalar::Util) >= 1.10 for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl-macros for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(threads::shared) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(threads) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(constant) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(Time::Local) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(Time::HiRes) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(Storable) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(Socket) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(Scalar::Util) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(Pod::Simple::XHTML) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(Pod::Simple::Search) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(Getopt::Long) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(Filter::Util::Call) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(File::Temp) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(File::Spec::Unix) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(File::Spec::Functions) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(File::Spec) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(File::Path) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(Exporter) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(Cwd) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(Carp) for package: 4:perl-5.16.3-299.el7_9.x86_64
---> Package perl-libs.x86_64 4:5.16.3-299.el7_9 will be installed
---> Package vim-common.x86_64 2:7.4.629-8.el7_9 will be installed
--> Processing Dependency: vim-filesystem for package: 2:vim-common-7.4.629-8.el7_9.x86_64
---> Package which.x86_64 0:2.20-7.el7 will be installed
--> Running transaction check
---> Package perl-Carp.noarch 0:1.26-244.el7 will be installed
---> Package perl-Exporter.noarch 0:5.68-3.el7 will be installed
---> Package perl-File-Path.noarch 0:2.09-2.el7 will be installed
---> Package perl-File-Temp.noarch 0:0.23.01-3.el7 will be installed
---> Package perl-Filter.x86_64 0:1.49-3.el7 will be installed
---> Package perl-Getopt-Long.noarch 0:2.40-3.el7 will be installed
--> Processing Dependency: perl(Pod::Usage) >= 1.14 for package: perl-Getopt-Long-2.40-3.el7.noarch
--> Processing Dependency: perl(Text::ParseWords) for package: perl-Getopt-Long-2.40-3.el7.noarch
---> Package perl-PathTools.x86_64 0:3.40-5.el7 will be installed
---> Package perl-Pod-Simple.noarch 1:3.28-4.el7 will be installed
--> Processing Dependency: perl(Pod::Escapes) >= 1.04 for package: 1:perl-Pod-Simple-3.28-4.el7.noarch
--> Processing Dependency: perl(Encode) for package: 1:perl-Pod-Simple-3.28-4.el7.noarch
---> Package perl-Scalar-List-Utils.x86_64 0:1.27-248.el7 will be installed
---> Package perl-Socket.x86_64 0:2.010-5.el7 will be installed
---> Package perl-Storable.x86_64 0:2.45-3.el7 will be installed
---> Package perl-Time-HiRes.x86_64 4:1.9725-3.el7 will be installed
---> Package perl-Time-Local.noarch 0:1.2300-2.el7 will be installed
---> Package perl-constant.noarch 0:1.27-2.el7 will be installed
---> Package perl-macros.x86_64 4:5.16.3-299.el7_9 will be installed
---> Package perl-threads.x86_64 0:1.87-4.el7 will be installed
---> Package perl-threads-shared.x86_64 0:1.43-6.el7 will be installed
---> Package vim-filesystem.x86_64 2:7.4.629-8.el7_9 will be installed
--> Running transaction check
---> Package perl-Encode.x86_64 0:2.51-7.el7 will be installed
---> Package perl-Pod-Escapes.noarch 1:1.04-299.el7_9 will be installed
---> Package perl-Pod-Usage.noarch 0:1.63-3.el7 will be installed
--> Processing Dependency: perl(Pod::Text) >= 3.15 for package: perl-Pod-Usage-1.63-3.el7.noarch
--> Processing Dependency: perl-Pod-Perldoc for package: perl-Pod-Usage-1.63-3.el7.noarch
---> Package perl-Text-ParseWords.noarch 0:3.29-4.el7 will be installed
--> Running transaction check
---> Package perl-Pod-Perldoc.noarch 0:3.20-4.el7 will be installed
--> Processing Dependency: perl(parent) for package: perl-Pod-Perldoc-3.20-4.el7.noarch
--> Processing Dependency: perl(HTTP::Tiny) for package: perl-Pod-Perldoc-3.20-4.el7.noarch
--> Processing Dependency: groff-base for package: perl-Pod-Perldoc-3.20-4.el7.noarch
---> Package perl-podlators.noarch 0:2.5.1-3.el7 will be installed
--> Running transaction check
---> Package groff-base.x86_64 0:1.22.2-8.el7 will be installed
---> Package perl-HTTP-Tiny.noarch 0:0.033-3.el7 will be installed
---> Package perl-parent.noarch 1:0.225-244.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
vim-enhanced x86_64 2:7.4.629-8.el7_9 updates 1.1 M
Installing for dependencies:
gpm-libs x86_64 1.20.7-6.el7 base 32 k
groff-base x86_64 1.22.2-8.el7 base 942 k
perl x86_64 4:5.16.3-299.el7_9 updates 8.0 M
perl-Carp noarch 1.26-244.el7 base 19 k
perl-Encode x86_64 2.51-7.el7 base 1.5 M
perl-Exporter noarch 5.68-3.el7 base 28 k
perl-File-Path noarch 2.09-2.el7 base 26 k
perl-File-Temp noarch 0.23.01-3.el7 base 56 k
perl-Filter x86_64 1.49-3.el7 base 76 k
perl-Getopt-Long noarch 2.40-3.el7 base 56 k
perl-HTTP-Tiny noarch 0.033-3.el7 base 38 k
perl-PathTools x86_64 3.40-5.el7 base 82 k
perl-Pod-Escapes noarch 1:1.04-299.el7_9 updates 52 k
perl-Pod-Perldoc noarch 3.20-4.el7 base 87 k
perl-Pod-Simple noarch 1:3.28-4.el7 base 216 k
perl-Pod-Usage noarch 1.63-3.el7 base 27 k
perl-Scalar-List-Utils x86_64 1.27-248.el7 base 36 k
perl-Socket x86_64 2.010-5.el7 base 49 k
perl-Storable x86_64 2.45-3.el7 base 77 k
perl-Text-ParseWords noarch 3.29-4.el7 base 14 k
perl-Time-HiRes x86_64 4:1.9725-3.el7 base 45 k
perl-Time-Local noarch 1.2300-2.el7 base 24 k
perl-constant noarch 1.27-2.el7 base 19 k
perl-libs x86_64 4:5.16.3-299.el7_9 updates 690 k
perl-macros x86_64 4:5.16.3-299.el7_9 updates 44 k
perl-parent noarch 1:0.225-244.el7 base 12 k
perl-podlators noarch 2.5.1-3.el7 base 112 k
perl-threads x86_64 1.87-4.el7 base 49 k
perl-threads-shared x86_64 1.43-6.el7 base 39 k
vim-common x86_64 2:7.4.629-8.el7_9 updates 5.9 M
vim-filesystem x86_64 2:7.4.629-8.el7_9 updates 11 k
which x86_64 2.20-7.el7 base 41 k
Transaction Summary
================================================================================
Install 1 Package (+32 Dependent packages)
Total download size: 19 M
Installed size: 63 M
Downloading packages:
warning: /var/cache/yum/x86_64/7/base/packages/perl-Carp-1.26-244.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for perl-Carp-1.26-244.el7.noarch.rpm is not installed
Public key for perl-Pod-Escapes-1.04-299.el7_9.noarch.rpm is not installed
--------------------------------------------------------------------------------
Total 9.5 MB/s | 19 MB 00:02
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
Userid : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
Package : centos-release-7-9.2009.0.el7.centos.x86_64 (@CentOS)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : gpm-libs-1.20.7-6.el7.x86_64 1/33
Installing : 2:vim-filesystem-7.4.629-8.el7_9.x86_64 2/33
Installing : 2:vim-common-7.4.629-8.el7_9.x86_64 3/33
Installing : which-2.20-7.el7.x86_64 4/33
install-info: No such file or directory for /usr/share/info/which.info.gz
Installing : groff-base-1.22.2-8.el7.x86_64 5/33
Installing : 1:perl-parent-0.225-244.el7.noarch 6/33
Installing : perl-HTTP-Tiny-0.033-3.el7.noarch 7/33
Installing : perl-podlators-2.5.1-3.el7.noarch 8/33
Installing : perl-Pod-Perldoc-3.20-4.el7.noarch 9/33
Installing : 1:perl-Pod-Escapes-1.04-299.el7_9.noarch 10/33
Installing : perl-Encode-2.51-7.el7.x86_64 11/33
Installing : perl-Text-ParseWords-3.29-4.el7.noarch 12/33
Installing : perl-Pod-Usage-1.63-3.el7.noarch 13/33
Installing : 4:perl-macros-5.16.3-299.el7_9.x86_64 14/33
Installing : perl-Storable-2.45-3.el7.x86_64 15/33
Installing : perl-Exporter-5.68-3.el7.noarch 16/33
Installing : perl-constant-1.27-2.el7.noarch 17/33
Installing : perl-Socket-2.010-5.el7.x86_64 18/33
Installing : perl-Time-Local-1.2300-2.el7.noarch 19/33
Installing : perl-Carp-1.26-244.el7.noarch 20/33
Installing : perl-PathTools-3.40-5.el7.x86_64 21/33
Installing : perl-Scalar-List-Utils-1.27-248.el7.x86_64 22/33
Installing : 1:perl-Pod-Simple-3.28-4.el7.noarch 23/33
Installing : perl-File-Temp-0.23.01-3.el7.noarch 24/33
Installing : perl-File-Path-2.09-2.el7.noarch 25/33
Installing : perl-threads-shared-1.43-6.el7.x86_64 26/33
Installing : perl-threads-1.87-4.el7.x86_64 27/33
Installing : 4:perl-Time-HiRes-1.9725-3.el7.x86_64 28/33
Installing : perl-Filter-1.49-3.el7.x86_64 29/33
Installing : 4:perl-libs-5.16.3-299.el7_9.x86_64 30/33
Installing : perl-Getopt-Long-2.40-3.el7.noarch 31/33
Installing : 4:perl-5.16.3-299.el7_9.x86_64 32/33
Installing : 2:vim-enhanced-7.4.629-8.el7_9.x86_64 33/33
Verifying : perl-HTTP-Tiny-0.033-3.el7.noarch 1/33
Verifying : perl-threads-shared-1.43-6.el7.x86_64 2/33
Verifying : perl-Storable-2.45-3.el7.x86_64 3/33
Verifying : groff-base-1.22.2-8.el7.x86_64 4/33
Verifying : perl-Exporter-5.68-3.el7.noarch 5/33
Verifying : perl-constant-1.27-2.el7.noarch 6/33
Verifying : perl-PathTools-3.40-5.el7.x86_64 7/33
Verifying : 4:perl-macros-5.16.3-299.el7_9.x86_64 8/33
Verifying : 2:vim-enhanced-7.4.629-8.el7_9.x86_64 9/33
Verifying : 1:perl-parent-0.225-244.el7.noarch 10/33
Verifying : perl-Socket-2.010-5.el7.x86_64 11/33
Verifying : which-2.20-7.el7.x86_64 12/33
Verifying : 2:vim-filesystem-7.4.629-8.el7_9.x86_64 13/33
Verifying : perl-File-Temp-0.23.01-3.el7.noarch 14/33
Verifying : 1:perl-Pod-Simple-3.28-4.el7.noarch 15/33
Verifying : perl-Time-Local-1.2300-2.el7.noarch 16/33
Verifying : 1:perl-Pod-Escapes-1.04-299.el7_9.noarch 17/33
Verifying : perl-Carp-1.26-244.el7.noarch 18/33
Verifying : 2:vim-common-7.4.629-8.el7_9.x86_64 19/33
Verifying : perl-Scalar-List-Utils-1.27-248.el7.x86_64 20/33
Verifying : perl-Pod-Usage-1.63-3.el7.noarch 21/33
Verifying : perl-Encode-2.51-7.el7.x86_64 22/33
Verifying : perl-Pod-Perldoc-3.20-4.el7.noarch 23/33
Verifying : perl-podlators-2.5.1-3.el7.noarch 24/33
Verifying : 4:perl-5.16.3-299.el7_9.x86_64 25/33
Verifying : perl-File-Path-2.09-2.el7.noarch 26/33
Verifying : perl-threads-1.87-4.el7.x86_64 27/33
Verifying : 4:perl-Time-HiRes-1.9725-3.el7.x86_64 28/33
Verifying : gpm-libs-1.20.7-6.el7.x86_64 29/33
Verifying : perl-Filter-1.49-3.el7.x86_64 30/33
Verifying : perl-Getopt-Long-2.40-3.el7.noarch 31/33
Verifying : perl-Text-ParseWords-3.29-4.el7.noarch 32/33
Verifying : 4:perl-libs-5.16.3-299.el7_9.x86_64 33/33
Installed:
vim-enhanced.x86_64 2:7.4.629-8.el7_9
Dependency Installed:
gpm-libs.x86_64 0:1.20.7-6.el7
groff-base.x86_64 0:1.22.2-8.el7
perl.x86_64 4:5.16.3-299.el7_9
perl-Carp.noarch 0:1.26-244.el7
perl-Encode.x86_64 0:2.51-7.el7
perl-Exporter.noarch 0:5.68-3.el7
perl-File-Path.noarch 0:2.09-2.el7
perl-File-Temp.noarch 0:0.23.01-3.el7
perl-Filter.x86_64 0:1.49-3.el7
perl-Getopt-Long.noarch 0:2.40-3.el7
perl-HTTP-Tiny.noarch 0:0.033-3.el7
perl-PathTools.x86_64 0:3.40-5.el7
perl-Pod-Escapes.noarch 1:1.04-299.el7_9
perl-Pod-Perldoc.noarch 0:3.20-4.el7
perl-Pod-Simple.noarch 1:3.28-4.el7
perl-Pod-Usage.noarch 0:1.63-3.el7
perl-Scalar-List-Utils.x86_64 0:1.27-248.el7
perl-Socket.x86_64 0:2.010-5.el7
perl-Storable.x86_64 0:2.45-3.el7
perl-Text-ParseWords.noarch 0:3.29-4.el7
perl-Time-HiRes.x86_64 4:1.9725-3.el7
perl-Time-Local.noarch 0:1.2300-2.el7
perl-constant.noarch 0:1.27-2.el7
perl-libs.x86_64 4:5.16.3-299.el7_9
perl-macros.x86_64 4:5.16.3-299.el7_9
perl-parent.noarch 1:0.225-244.el7
perl-podlators.noarch 0:2.5.1-3.el7
perl-threads.x86_64 0:1.87-4.el7
perl-threads-shared.x86_64 0:1.43-6.el7
vim-common.x86_64 2:7.4.629-8.el7_9
vim-filesystem.x86_64 2:7.4.629-8.el7_9
which.x86_64 0:2.20-7.el7
Complete!
Removing intermediate container b83f42ac8d51
---> 5316756f1b5e
Step 6/10 : RUN yum -y install net-tools
---> Running in 9064f7db9162
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package net-tools.x86_64 0:2.0-0.25.20131004git.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
net-tools x86_64 2.0-0.25.20131004git.el7 base 306 k
Transaction Summary
================================================================================
Install 1 Package
Total download size: 306 k
Installed size: 917 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : net-tools-2.0-0.25.20131004git.el7.x86_64 1/1
Verifying : net-tools-2.0-0.25.20131004git.el7.x86_64 1/1
Installed:
net-tools.x86_64 0:2.0-0.25.20131004git.el7
Complete!
Removing intermediate container 9064f7db9162
---> 563bf211d346
Step 7/10 : EXPOSE 80
---> Running in 0af42b75890c
Removing intermediate container 0af42b75890c
---> 669f9d6d4596
Step 8/10 : CMD echo $MYPATH
---> Running in 23e8185ca95c
Removing intermediate container 23e8185ca95c
---> 4238b045f568
Step 9/10 : CMD echo "----end----"
---> Running in 4057a4bec344
Removing intermediate container 4057a4bec344
---> a9be56ade9f7
Step 10/10 : CMD /bin/bash
---> Running in b0381ec55d01
Removing intermediate container b0381ec55d01
---> 13db9c2c8947
Successfully built 13db9c2c8947
Successfully tagged mycentos:0.1
[root@VM-0-10-centos dockerfile]
[root@c2f564a56533 local]
/usr/local
[root@c2f564a56533 local]
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.17.0.5 netmask 255.255.0.0 broadcast 172.17.255.255
ether 02:42:ac:11:00:05 txqueuelen 0 (Ethernet)
RX packets 12 bytes 936 (936.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
loop txqueuelen 1000 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@c2f564a56533 local]
构建自己的Tomcat
[root@VM-0-10-centos home]
total 157536
-rw-r--r-- 1 root root 11597709 Oct 24 20:19 apache-tomcat-9.0.68.tar.gz
drwxr-xr-x 6 unbound root 4096 Oct 22 20:42 data
drwxr-xr-x 2 root root 4096 Oct 23 23:01 dockerfile
drwxr-xr-x 2 root root 4096 Oct 23 15:56 docker-test-volume
-rw-r--r-- 1 root root 149697219 Oct 24 20:29 jdk-8u351-linux-x64.tar.gz
drwxr-xr-x 3 root root 4096 Oct 22 19:42 mysql
- 编写dockerfile文件,官方命名
Dockerfile
,build会自动寻找这个文件,就不需要 -f
指定了
[root@VM-0-10-centos tomcat]
[root@VM-0-10-centos tomcat]
FROM centos:7
MAINTAINER sanbai<763417647@qq.com>
ADD jdk-8u351-linux-x64.tar.gz /usr/local/
ADD apache-tomcat-9.0.68.tar.gz /usr/local/
RUN yum -y install vim
ENV MYPATH /usr/local
WORKDIR $MYPATH
ENV JAVA_HOME /usr/local/jdk1.8.0_351
ENV CLASSPATH $JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
ENV CATALINA_HOME /usr/local/apache-tomcat-9.0.68
ENV CATALINA_BASH /usr/local/apache-tomcat-9.0.68
ENV PATH $PATH:$JAVA_HOME/bin:$CATALINA_HOME/lib:$CATALINA_HOME/bin
EXPOSE 8080
CMD /usr/local/apache-tomcat-9.0.68/bin/startup.sh && tail -F /usr/local/apache-tomcat-9.0.68/bin/logs/catalina.out
[root@VM-0-10-centos tomcat]
Sending build context to Docker daemon 161.3MB
Step 1/14 : FROM centos:7
......
Successfully built c80000b9b2d3
Successfully tagged diytomcat:latest
[root@VM-0-10-centos tomcat]
REPOSITORY TAG IMAGE ID CREATED SIZE
diytomcat latest c80000b9b2d3 4 minutes ago 834MB
mycentos 0.1 13db9c2c8947 23 hours ago 625MB
<none> <none> e2287f1dc69e 23 hours ago 231MB
sunbai/centos 1.0 5571c282f543 30 hours ago 231MB
nginx latest 605c77e624dd 9 months ago 141MB
mysql 5.7 c20987f18b13 10 months ago 448MB
centos 7 eeb6ee3f44bd 13 months ago 204MB
centos latest 5d0da3dc9764 13 months ago 231MB
[root@VM-0-10-centos tomcatlogs]
4f7fbd29e45c383b5214b9311b490e2b2e526ece3e5a3729aa5db1d2dffae5d9
[root@VM-0-10-centos tomcat]
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
bf93867bc633 diytomcat "/bin/sh -c '/usr/lo…" 52 seconds ago Up 50 seconds 0.0.0.0:8080->8080/tcp, :::8080->8080/tcp sunbai
e50ac9d277f8 sunbai/centos:1.0 "/bin/sh -c /bin/bash" 28 hours ago Up 28 hours docker01
bb042de99b86 nginx "/docker-entrypoint.…" 32 hours ago Up 32 hours 0.0.0.0:49154->80/tcp, :::49154->80/tcp nginx02
3d0332f678c3 nginx "/docker-entrypoint.…" 32 hours ago Up 32 hours 0.0.0.0:49153->80/tcp, :::49153->80/tcp nginx01
[root@VM-0-10-centos tomcat]
[root@VM-0-10-centos tomcat]
test tomcatlogs
[root@VM-0-10-centos tomcat]
[root@bf93867bc633 local]
apache-tomcat-9.0.68 bin etc games include jdk1.8.0_351 lib lib64 libexec sbin share src
[root@bf93867bc633 local]
/usr/local
[root@bf93867bc633 local]
[root@bf93867bc633 apache-tomcat-9.0.68]
BUILDING.txt LICENSE README.md RUNNING.txt conf logs webapps
CONTRIBUTING.md NOTICE RELEASE-NOTES bin lib temp work
- 到/home/sunbai/build/tomcat/tomcatlogs/文件夹下查看下启动日志
[root@VM-0-10-centos tomcat]
[root@VM-0-10-centos tomcatlogs]
catalina.2022-10-24.log host-manager.2022-10-24.log localhost_access_log.2022-10-24.txt
catalina.out localhost.2022-10-24.log manager.2022-10-24.log
[root@VM-0-10-centos tomcatlogs]
24-Oct-2022 15:08:23.161 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version name: Apache Tomcat/9.0.68
......
24-Oct-2022 15:08:24.997 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
24-Oct-2022 15:08:25.018 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in [1028] milliseconds
- 访问下这个Tomcat,成功了
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/44a9fddb0f736ab6ba6f7435787ad8f0.png)
- 往/home/sunbai/build/tomcat/test添加HTML文件
[root@VM-0-10-centos ~]
[root@VM-0-10-centos test]
[root@VM-0-10-centos test]
[root@VM-0-10-centos test]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body>
<h1>我的第一个标题</h1>
<p>我的第一个段落。</p>
</body>
</html>
- 访问一下这个页面,成功
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/95f62051b665c136b7d466a89c4acb0b.png)
Redis集群部署实战
[root@VM-0-10-centos ~]
fee2378bf266a29c9745d53cc165cca8f285b37a9175c4b661ebfcafa8bb96ca
[root@VM-0-10-centos ~]
NETWORK ID NAME DRIVER SCOPE
72b5fd5f989d bridge bridge local
ea4002e14ec1 host host local
46cac985389d mynet bridge local
221aaac7ba29 none null local
fee2378bf266 redis bridge local
for port in $(seq 1 6); \
do \
mkdir -p /mydata/redis/node-${port}/conf
touch /mydata/redis/node-${port}/conf/redis.conf
cat << EOF >/mydata/redis/node-${port}/conf/redis.conf
port 6379
bind 0.0.0.0
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
cluster-announce-ip 172.38.0.1${port}
cluster-announce-port 6379
cluster-announce-bus-port 16379
appendonly yes
EOF
done
[root@VM-0-10-centos ~]
-v /mydata/redis/node-1/data:/data \
-v /mydata/redis/node-1/conf/redis.conf:/etc/redis/redis.conf \
-d --net redis --ip 172.38.0.11 redis:5.0.9-alpine3.11 redis-server /etc/redis/redis.conf
Unable to find image 'redis:5.0.9-alpine3.11' locally
5.0.9-alpine3.11: Pulling from library/redis
cbdbe7a5bc2a: Pull complete
dc0373118a0d: Pull complete
cfd369fe6256: Pull complete
3e45770272d9: Pull complete
558de8ea3153: Pull complete
a2c652551612: Pull complete
Digest: sha256:83a3af36d5e57f2901b4783c313720e5fa3ecf0424ba86ad9775e06a9a5e35d0
Status: Downloaded newer image for redis:5.0.9-alpine3.11
fb849a84983b2d8fbd55ea5276fbab26d47495b1ed3128b12644a72e65a3d353
docker run -p 6372:6379 -p 16372:16379 --name redis-2 \
-v /mydata/redis/node-2/data:/data \
-v /mydata/redis/node-2/conf/redis.conf:/etc/redis/redis.conf \
-d --net redis --ip 172.38.0.12 redis:5.0.9-alpine3.11 redis-server /etc/redis/redis.conf
docker run -p 6373:6379 -p 16373:16379 --name redis-3 \
-v /mydata/redis/node-3/data:/data \
-v /mydata/redis/node-3/conf/redis.conf:/etc/redis/redis.conf \
-d --net redis --ip 172.38.0.13 redis:5.0.9-alpine3.11 redis-server /etc/redis/redis.conf
docker run -p 6374:6379 -p 16374:16379 --name redis-4 \
-v /mydata/redis/node-4/data:/data \
-v /mydata/redis/node-4/conf/redis.conf:/etc/redis/redis.conf \
-d --net redis --ip 172.38.0.14 redis:5.0.9-alpine3.11 redis-server /etc/redis/redis.conf
docker run -p 6375:6379 -p 16375:16379 --name redis-5 \
-v /mydata/redis/node-5/data:/data \
-v /mydata/redis/node-5/conf/redis.conf:/etc/redis/redis.conf \
-d --net redis --ip 172.38.0.15 redis:5.0.9-alpine3.11 redis-server /etc/redis/redis.conf
docker run -p 6376:6379 -p 16376:16379 --name redis-6 \
-v /mydata/redis/node-6/data:/data \
-v /mydata/redis/node-6/conf/redis.conf:/etc/redis/redis.conf \
-d --net redis --ip 172.38.0.16 redis:5.0.9-alpine3.11 redis-server /etc/redis/redis.conf
[root@VM-0-10-centos ~]
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c46ce8b66719 redis:5.0.9-alpine3.11 "docker-entrypoint.s…" 3 seconds ago Up 2 seconds 0.0.0.0:6376->6379/tcp, :::6376->6379/tcp, 0.0.0.0:16376->16379/tcp, :::16376->16379/tcp redis-6
690559f81f51 redis:5.0.9-alpine3.11 "docker-entrypoint.s…" 16 seconds ago Up 16 seconds 0.0.0.0:6375->6379/tcp, :::6375->6379/tcp, 0.0.0.0:16375->16379/tcp, :::16375->16379/tcp redis-5
a166b898a334 redis:5.0.9-alpine3.11 "docker-entrypoint.s…" 28 seconds ago Up 28 seconds 0.0.0.0:6374->6379/tcp, :::6374->6379/tcp, 0.0.0.0:16374->16379/tcp, :::16374->16379/tcp redis-4
bf6fa2c54294 redis:5.0.9-alpine3.11 "docker-entrypoint.s…" 56 seconds ago Up 56 seconds 0.0.0.0:6373->6379/tcp, :::6373->6379/tcp, 0.0.0.0:16373->16379/tcp, :::16373->16379/tcp redis-3
220c8d73225c redis:5.0.9-alpine3.11 "docker-entrypoint.s…" About a minute ago Up About a minute 0.0.0.0:6372->6379/tcp, :::6372->6379/tcp, 0.0.0.0:16372->16379/tcp, :::16372->16379/tcp redis-2
7d7306f91007 redis:5.0.9-alpine3.11 "docker-entrypoint.s…" About a minute ago Up About a minute 0.0.0.0:6371->6379/tcp, :::6371->6379/tcp, 0.0.0.0:16371->16379/tcp, :::16371->16379/tcp redis-1
[root@VM-0-10-centos ~]
/data
appendonly.aof nodes.conf
/data
/data
75614021665e6c789a7201373d905c83ee9a239a :0@0 myself,master - 0 0 0 connected
vars currentEpoch 0 lastVoteEpoch 0
/data
72.38.0.15:6379 172.38.0.16:6379 --cluster-replicas 1
>>> Performing hash slots allocation on 7 nodes...
Master[0] -> Slots 0 - 5460
Master[1] -> Slots 5461 - 10922
Master[2] -> Slots 10923 - 16383
Adding replica 172.38.0.15:6379 to 172.38.0.11:6379
Adding replica 172.38.0.16:6379 to 172.38.0.12:6379
Adding replica 172.38.0.15:6379 to 172.38.0.13:6379
Adding extra replicas...
Adding replica 172.38.0.14:6379 to 172.38.0.11:6379
M: 75614021665e6c789a7201373d905c83ee9a239a 172.38.0.11:6379
slots:[0-5460] (5461 slots) master
M: 004c4f22bc689e926bfa0a3588c94f05c85df3d5 172.38.0.12:6379
slots:[5461-10922] (5462 slots) master
M: 4da2d19c9fb700a3cd9c73d1b571e3db27452e97 172.38.0.13:6379
slots:[10923-16383] (5461 slots) master
S: a9d523fef348f24534cb17f9545c08b02528631c 172.38.0.14:6379
replicates 75614021665e6c789a7201373d905c83ee9a239a
S: 25887c8d297a1df4608d6ded95ebc5a8f7a2f335 172.38.0.15:6379
replicates 75614021665e6c789a7201373d905c83ee9a239a
S: 25887c8d297a1df4608d6ded95ebc5a8f7a2f335 172.38.0.15:6379
replicates 4da2d19c9fb700a3cd9c73d1b571e3db27452e97
S: 5ec9426040b95800d36c3788ea904bad909030d6 172.38.0.16:6379
replicates 004c4f22bc689e926bfa0a3588c94f05c85df3d5
Can I set the above configuration? (type 'yes' to accept): yes
>>> Nodes configuration updated
>>> Assign a different config epoch to each node
>>> Sending CLUSTER MEET messages to join the cluster
Waiting for the cluster to join
...
>>> Performing Cluster Check (using node 172.38.0.11:6379)
M: 75614021665e6c789a7201373d905c83ee9a239a 172.38.0.11:6379
slots:[0-5460] (5461 slots) master
1 additional replica(s)
S: 25887c8d297a1df4608d6ded95ebc5a8f7a2f335 172.38.0.15:6379
slots: (0 slots) slave
replicates 4da2d19c9fb700a3cd9c73d1b571e3db27452e97
M: 004c4f22bc689e926bfa0a3588c94f05c85df3d5 172.38.0.12:6379
slots:[5461-10922] (5462 slots) master
1 additional replica(s)
M: 4da2d19c9fb700a3cd9c73d1b571e3db27452e97 172.38.0.13:6379
slots:[10923-16383] (5461 slots) master
1 additional replica(s)
S: a9d523fef348f24534cb17f9545c08b02528631c 172.38.0.14:6379
slots: (0 slots) slave
replicates 75614021665e6c789a7201373d905c83ee9a239a
S: 5ec9426040b95800d36c3788ea904bad909030d6 172.38.0.16:6379
slots: (0 slots) slave
replicates 004c4f22bc689e926bfa0a3588c94f05c85df3d5
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.
/data
127.0.0.1:6379> cluster info
cluster_state:ok
cluster_slots_assigned:16384
cluster_slots_ok:16384
cluster_slots_pfail:0
cluster_slots_fail:0
cluster_known_nodes:6
cluster_size:3
cluster_current_epoch:7
cluster_my_epoch:1
cluster_stats_messages_ping_sent:383
cluster_stats_messages_pong_sent:367
cluster_stats_messages_sent:750
cluster_stats_messages_ping_received:362
cluster_stats_messages_pong_received:383
cluster_stats_messages_meet_received:5
cluster_stats_messages_received:750
127.0.0.1:6379> cluster nodes
25887c8d297a1df4608d6ded95ebc5a8f7a2f335 172.38.0.15:6379@16379 slave 4da2d19c9fb700a3cd9c73d1b571e3db27452e97 0 1667131849589 5 connected
75614021665e6c789a7201373d905c83ee9a239a 172.38.0.11:6379@16379 myself,master - 0 1667131850000 1 connected 0-5460
004c4f22bc689e926bfa0a3588c94f05c85df3d5 172.38.0.12:6379@16379 master - 0 1667131850089 2 connected 5461-10922
4da2d19c9fb700a3cd9c73d1b571e3db27452e97 172.38.0.13:6379@16379 master - 0 1667131849088 3 connected 10923-16383
a9d523fef348f24534cb17f9545c08b02528631c 172.38.0.14:6379@16379 slave 75614021665e6c789a7201373d905c83ee9a239a 0 1667131849000 4 connected
5ec9426040b95800d36c3788ea904bad909030d6 172.38.0.16:6379@16379 slave 004c4f22bc689e926bfa0a3588c94f05c85df3d5 0 1667131850590 7 connected
127.0.0.1:6379> set a b
-> Redirected to slot [15495] located at 172.38.0.13:6379
OK
[root@VM-0-10-centos ~]
redis-3
[root@VM-0-10-centos ~]
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c46ce8b66719 redis:5.0.9-alpine3.11 "docker-entrypoint.s…" 23 minutes ago Up 23 minutes 0.0.0.0:6376->6379/tcp, :::6376->6379/tcp, 0.0.0.0:16376->16379/tcp, :::16376->16379/tcp redis-6
690559f81f51 redis:5.0.9-alpine3.11 "docker-entrypoint.s…" 23 minutes ago Up 23 minutes 0.0.0.0:6375->6379/tcp, :::6375->6379/tcp, 0.0.0.0:16375->16379/tcp, :::16375->16379/tcp redis-5
a166b898a334 redis:5.0.9-alpine3.11 "docker-entrypoint.s…" 23 minutes ago Up 23 minutes 0.0.0.0:6374->6379/tcp, :::6374->6379/tcp, 0.0.0.0:16374->16379/tcp, :::16374->16379/tcp redis-4
220c8d73225c redis:5.0.9-alpine3.11 "docker-entrypoint.s…" 24 minutes ago Up 24 minutes 0.0.0.0:6372->6379/tcp, :::6372->6379/tcp, 0.0.0.0:16372->16379/tcp, :::16372->16379/tcp redis-2
7d7306f91007 redis:5.0.9-alpine3.11 "docker-entrypoint.s…" 24 minutes ago Up 24 minutes 0.0.0.0:6371->6379/tcp, :::6371->6379/tcp, 0.0.0.0:16371->16379/tcp, :::16371->16379/tcp redis-1
172.38.0.13:6379> get a
Error: Operation timed out
/data
127.0.0.1:6379> get a
-> Redirected to slot [15495] located at 172.38.0.15:6379
"b"
172.38.0.15:6379> cluster nodes
4da2d19c9fb700a3cd9c73d1b571e3db27452e97 172.38.0.13:6379@16379 master,fail - 1667132142577 1667132141673 3 connected
25887c8d297a1df4608d6ded95ebc5a8f7a2f335 172.38.0.15:6379@16379 myself,master - 0 1667132320000 8 connected 10923-16383
004c4f22bc689e926bfa0a3588c94f05c85df3d5 172.38.0.12:6379@16379 master - 0 1667132321526 2 connected 5461-10922
5ec9426040b95800d36c3788ea904bad909030d6 172.38.0.16:6379@16379 slave 004c4f22bc689e926bfa0a3588c94f05c85df3d5 0 1667132322529 7 connected
a9d523fef348f24534cb17f9545c08b02528631c 172.38.0.14:6379@16379 slave 75614021665e6c789a7201373d905c83ee9a239a 0 1667132322529 4 connected
75614021665e6c789a7201373d905c83ee9a239a 172.38.0.11:6379@16379 master - 0 1667132321025 1 connected 0-5460
SpringBoot微服务打包Dokcer镜像
- 构建SpringBoot项目
这里直接使用若依框架的system模块 - 编写dockerfile
FROM java:8
COPY *.jar /app.jar
CMD ["--server.port=9201"]
EXPOSE 9201
ENTRYPOINT ["java", "-jar", "/app.jar"]
[root@VM-0-10-centos ruoyi-modules-system]
Dockerfile ruoyi-modules-system.jar
[root@VM-0-10-centos ruoyi-modules-system]
Sending build context to Docker daemon 113.1MB
Step 1/5 : FROM java:8
8: Pulling from library/java
5040bd298390: Pull complete
fce5728aad85: Pull complete
76610ec20bf5: Pull complete
60170fec2151: Pull complete
e98f73de8f0d: Pull complete
11f7af24ed9c: Pull complete
49e2d6393f32: Pull complete
bb9cdec9c7f3: Pull complete
Digest: sha256:c1ff613e8ba25833d2e1940da0940c3824f03f802c449f3d1815a66b7f8c0e9d
Status: Downloaded newer image for java:8
---> d23bdf5b1b1b
Step 2/5 : COPY *.jar /app.jar
---> 5518a06d5b4a
Step 3/5 : CMD ["--server.port=9201"]
---> Running in a6898766a8a7
Removing intermediate container a6898766a8a7
---> ab53a5f07757
Step 4/5 : EXPOSE 9201
---> Running in 6778917af320
Removing intermediate container 6778917af320
---> dfaa63f3c09d
Step 5/5 : ENTRYPOINT ["java", "-jar", "/app.jar"]
---> Running in 6798bf8381a7
Removing intermediate container 6798bf8381a7
---> 935588e0522f
Successfully built 935588e0522f
Successfully tagged sunbai:latest
[root@VM-0-10-centos ruoyi-modules-system]
REPOSITORY TAG IMAGE ID CREATED SIZE
sunbai latest 935588e0522f 2 minutes ago 756MB
tomcat latest fb5657adc892 10 months ago 680MB
tomcat 7.0 9dfd74e6bc2f 16 months ago 533MB
redis 5.0.9-alpine3.11 3661c84ee9d0 2 years ago 29.8MB
java 8 d23bdf5b1b1b 5 years ago 643MB
docker run -d --ulimit nofile=1024:1024 -p 9201:9201 --name ruoyi-modules-system sunbai
- 登录一下系统,登录成功
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/01100eb3ea8fb5d8128f05cdee3647f4.png)