Docker deploys Nginx and Tomcat

Article directory


foreword

Table of contents

Article directory

foreword

1. Docker deploys Nginx

2. Docker deploys Tomcat

Summarize



1. Docker deploys Nginx

Download mirror: docker pull nginx

Run the mirror in the background -d run in the background --name="nginx01" name the container -p host port: the internal port of the container

docker run -d --name="nginx-1" -p 3344:80 nginx

 # 进入容器
 [root@192 ~]# docker exec -it a1e130aa184d /bin/bash
 root@a1e130aa184d:/# whereis nginx
 nginx: /usr/sbin/nginx /usr/lib/nginx /etc/nginx /usr/share/nginx
 root@a1e130aa184d:/# cd /etc/nginx/
 root@a1e130aa184d:/etc/nginx# ls
 conf.d  fastcgi_params  mime.types  modules  nginx.conf  scgi_params  uwsgi_params

Virtual machine native testing

curl localhost:3344

 

 

 

 

2. Docker deploys Tomcat

 Download image docker pull tomcat

Background start docker run -d --name="tomcat01" -p 3355:8080 tomcat

docker exec -it tomcat01 /bin/bash enters the interior and copies the webapp.dist file to webapps

cp -r webapps.dist/* webapps

You can find the tomcat interface by testing


Summarize

Guess you like

Origin blog.csdn.net/qq_55648724/article/details/128781181