Docker部署网站之后映射域名
Docker中部署tomcat相信大家也都知道,不知道的可以google 或者bing 一下。这里主要是为了记录在我们启动容器之后,tomcat需要直接定位到网站信息,而不是打开域名之后,还得加个blog后缀才能访问到我们的网站首页。
Docker exec -it [容器id] bash
进到/usr/local/tomcat/conf/ 修改 server.xml。
在我们安装完docker容器,第一次进到容器内部的时候,是没有vi命令的,需要我们进行安装。
执行apt-get install vi/vim会报以下问题。
root@4c160951c197:/usr/local/tomcat/conf# apt-get install vi
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package vi
执行apt-get update,这个命令的作用是:同步 /etc/apt/sources.list 和 /etc/apt/sources.list.d 中列出的源的索引,这样才能获取到最新的软件包。
root@4c160951c197:~# apt-get install vim
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libgpm2 vim-common vim-runtime xxd
Suggested packages:
gpm ctags vim-doc vim-scripts
The following NEW packages will be installed:
libgpm2 vim vim-common vim-runtime xxd
0 upgraded, 5 newly installed, 0 to remove and 3 not upgraded.
Need to get 6769 kB of archives.
After this operation, 31.2 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://deb.debian.org/debian stretch/main amd64 libgpm2 amd64 1.20.4-6.2+b1 [34.2 kB]
Get:2 http://security.debian.org/debian-security stretch/updates/main amd64 xxd amd64 2:8.0.0197-4+deb9u3 [132 kB]
Get:3 http://security.debian.org/debian-security stretch/updates/main amd64 vim-common all 2:8.0.0197-4+deb9u3 [159 kB]
Get:4 http://security.debian.org/debian-security stretch/updates/main amd64 vim-runtime all 2:8.0.0197-4+deb9u3 [5409 kB]
Get:5 http://security.debian.org/debian-security stretch/updates/main amd64 vim amd64 2:8.0.0197-4+deb9u3 [1034 kB]
Fetched 6769 kB in 3min 54s (28.8 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package xxd.
(Reading database ... 12446 files and directories currently installed.)
Preparing to unpack .../xxd_2%3a8.0.0197-4+deb9u3_amd64.deb ...
Unpacking xxd (2:8.0.0197-4+deb9u3) ...
Selecting previously unselected package vim-common.
Preparing to unpack .../vim-common_2%3a8.0.0197-4+deb9u3_all.deb ...
Unpacking vim-common (2:8.0.0197-4+deb9u3) ...
Selecting previously unselected package libgpm2:amd64.
Preparing to unpack .../libgpm2_1.20.4-6.2+b1_amd64.deb ...
Unpacking libgpm2:amd64 (1.20.4-6.2+b1) ...
Selecting previously unselected package vim-runtime.
Preparing to unpack .../vim-runtime_2%3a8.0.0197-4+deb9u3_all.deb ...
Adding 'diversion of /usr/share/vim/vim80/doc/help.txt to /usr/share/vim/vim80/doc/help.txt.vim-tiny by vim-runtime'
Adding 'diversion of /usr/share/vim/vim80/doc/tags to /usr/share/vim/vim80/doc/tags.vim-tiny by vim-runtime'
Unpacking vim-runtime (2:8.0.0197-4+deb9u3) ...
Selecting previously unselected package vim.
Preparing to unpack .../vim_2%3a8.0.0197-4+deb9u3_amd64.deb ...
Unpacking vim (2:8.0.0197-4+deb9u3) ...
Processing triggers for mime-support (3.60) ...
Setting up xxd (2:8.0.0197-4+deb9u3) ...
Setting up libgpm2:amd64 (1.20.4-6.2+b1) ...
Processing triggers for libc-bin (2.24-11+deb9u4) ...
Setting up vim-common (2:8.0.0197-4+deb9u3) ...
Setting up vim-runtime (2:8.0.0197-4+deb9u3) ...
Setting up vim (2:8.0.0197-4+deb9u3) ...
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vim (vim) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vimdiff (vimdiff) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/rvim (rvim) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/rview (rview) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vi (vi) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/view (view) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/ex (ex) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/editor (editor) in auto mode
root@4c160951c197:~# cd /usr/local/tomcat/conf/
修改/usr/local/tomcat/conf/server.xml
...
<!--修改defaultHost-->
<Engine name="Catalina" defaultHost="life-runner.com">
...
<!--改变appBase对应的目录-->
<Host name="life-runner.com" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->
<!-- Access log processes all example.
Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" -->
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
<!--添加文件appBase对应的目录-->
<Context path="" docBase ="../webapps/blog/"/>
</Host>
...
重启blog容器
# [root@sxzhongf-test tmp]# docker run -d -p 80:8080 isaac-blog:1.0 启动容器
[root@sxzhongf-test tmp]# docker restart [容器id]

Docker部署网站之后映射域名的更多相关文章
- Docker -- 2 -- 利用docker部署网站和数据库
在Docker – 系统整洁之道 – 1中已经对Docker的一些命令和Docker镜像的使用及操作做了记录. 这次就利用docker进行一次真正的实例使用,使用docker搭建一个简单的答题系统,这 ...
- Taurus.MVC 微服务框架 入门开发教程:项目部署:6、微服务应用程序Docker部署实现多开。
系列目录: 本系列分为项目集成.项目部署.架构演进三个方向,后续会根据情况调整文章目录. 开源地址:https://github.com/cyq1162/Taurus.MVC 本系列第一篇:Tauru ...
- Linux上用Jexus部署Asp.Net网站:常规部署与Docker部署
(一)常规部署 一.把 jexus压缩包下载到linux临时文件夹中. cd /tmp wget linuxdot.net/down/jexus-6.2.x-arm64.tar.gz (不同的操作系统 ...
- 在生产环境使用Docker部署应用
导读 Docker现在越来越流行,但是真正在生产环境部署Docker还是个比较新的概念,还没有一个标准的流程.作者是ROR的程序员,作者结合平时的部署经验,联系Docker的特点,向大家分享了其在生产 ...
- Docker 使用指南 (六)—— 使用 Docker 部署 Django 容器栈
版权声明:本文由田飞雨原创文章,转载请注明出处: 文章原文链接:https://www.qcloud.com/community/article/98 来源:腾云阁 https://www.qclou ...
- [转]IIS上部署网站
如何在IIS6,7中部署ASP.NET网站 阅读目录 开始 查看web.config文件 在IIS中创建网站 IIS6 添加扩展名映射 IIS6 无扩展名的映射 目录的写入权限 SQL SERVER的 ...
- centos7使用docker部署gitlab-ce-zh应用
1.国内拉取镜像比较慢,所以这里采用DaoCloud源. # curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http ...
- 教你使用docker部署淘宝rap2服务
什么是rap2 先来说说起因,在上一个星期的分享会上,谈到前后端联调上,有同事提到了rap2,特意去了解了一下,觉得使用这个东西来进行前后端的接口联调来真是太方便了,对比我们之前公司内部开发的API ...
- Spring Boot 2 (六):使用 Docker 部署 Spring Boot 开源软件云收藏
Spring Boot 2 (六):使用 Docker 部署 Spring Boot 开源软件云收藏 云收藏项目已经开源3年多了,作为当初刚开始学习 Spring Boot 的练手项目,使用了很多当时 ...
随机推荐
- 8.秋招复习简单整理之Spring面试一般问题
1.不同版本的Spring Framework有哪些主要功能? 2.什么是Spring Framework? Spring是一个轻量级的IOC和AOP容器框架,是为Java应用程序提供基础性服务的一套 ...
- Java设计模式学习笔记(二) 简单工厂模式
前言 本篇是设计模式学习笔记的其中一篇文章,如对其他模式有兴趣,可从该地址查找设计模式学习笔记汇总地址 正文开始... 1. 简介 简单工厂模式不属于GoF23中设计模式之一,但在软件开发中应用也较为 ...
- Linux查看空间大小的命令
在linux中,常用查看空间大小的命令有df.du,下面依次介绍一下. df 命令是linux系统上以磁盘分区为单位来查看文件系统的命令,后面可以加上不同的参数来查看磁盘的剩余空间信息.Linux d ...
- Java 客户端负载均衡
客户端侧负载均衡 在下图中,负载均衡能力算法是由内容中心提供,内容中心相对于用户中心来说,是用户中心的客户端,所以又被称为客户端侧负载均衡 自定义实现Client Random负载均衡 获取所有的服务 ...
- The Summer Training Summary-- the first
The Summer Training Summary-- the first A - vector的使用 UVa 101 关于vector 的几个注意点 vector p p.push_back() ...
- linux svn 中文 https://my.oschina.net/VASKS/blog/659236
https://my.oschina.net/VASKS/blog/659236 设置服务器: export LC_ALL=zh_CN.UTF-8长久之计, echo export LC_ALL=zh ...
- 洛谷 P4363 [九省联考2018]一双木棋chess 题解
题目链接:https://www.luogu.org/problemnew/show/P4363 分析: 首先博弈,然后考虑棋盘的规则,因为一个子在落下时它的上面和左面都已经没有空位了,所以棋子的右下 ...
- Excel催化剂开源第28波-调用Google规划求解库
在Excel催化剂的自定义函数中,有规划求解的函数,用于在一些凑数的场景,某财务工作网友向我提出的需求,例如用于凑发票额使用. 一般开发票的场景是多次采购合在一起开具,即多个订单产生后开,同时发票一般 ...
- [小米OJ] 2. 找出单独出现的数字
解法一: map 1.45 ms #include <algorithm> #include <bitset> #include <cmath> #include ...
- [HDOJ] 2026.Max Sum
2026.Max Sum (c++) Problem Description Consider the aggregate An= { 1, 2, -, n }. For example, A1={1 ...