1、安装镜像

1. Install the image:

可以先到https://hub.docker.com/  搜索镜像

You can get there first. https://hub.docker.com/  search mirror

或使用docker search 镜像名称

or use docker search  image name

docker pull tomcat

2、查看验证下载好的镜像

docker images

3、启动tomcat

3. Start tomcat2. Check and verify the downloaded image.

-p : 8080 in front is the port of this machine, 8080 after the colon is the port of docker container, and tomcat is 8080 by default.

-d:后台运行

-i  启动这个容器

-t 容器创建成功后我们可以进入到容器中

-d: Run in background

--name : 是给容器起一个别名,方便使用,不然docker会默认给容器一个随机字符串的名称

--name : is to give an alias to the container for easy use, otherwise docker will give the container a random string name by default

-v 用来指定目录映射  --指定宿主机的某一个目录和容器中的某一个目录的对应关系

-p 用来指定端口映射  --指定宿主机的某一端口和容器中运行软件端口的对应关系:例如前边的8080是linux本机的端口,冒号后面的8080是docker容器的端口,tomcat默认是8080

-v: file mount path (not used in the above command)

docker run  -it -d --name tomcat
-v /var/lib/docker/volumes/tomcat:/usr/local/tomcat/webapps
-v /var/lib/docker/volumes/tomcat:/usr/local/tomcat/logs
-v /usr/local/tomcat/conf:/usr/local/tomcat/conf -p 8080:8080 tomcat

4、查看tomcat安装位置

View tomcat installation location

docker exec -it tomcat  /bin/bash

如果想得到容器更为详细信息,例如。挂载目录、tomcat版本等

(2) sudo docker inspect -f {{.State.Pid}} 44fc0f0582d9(2), and then get the full ID according to either of these two items.

docker inspect 容器ID

5、高版本的tomcat,默认把webapps下的测试应用移动到了webapps.dist

(3) Copy the file from the local to the docker container

cp -rf  /usr/local/tomcat/webapps.dist/ROOT  /usr/local/tomcat/webapps/ROOT

6、访问测试

http://localhost:8080/

原文出处【开源吧】:https://www.ossbar.com/#/platformConsultingDetails?newsId=186

Docker安装Tomcat应用服务器的更多相关文章

  1. docker安装tomcat并部署web项目

    docker安装tomcat就不说了,网上一大把 启动tomcat: docker run --name tomcat -p 8080:8080 -v $PWD/test:/usr/local/tom ...

  2. docker安装tomcat&部署javaweb程序

    一.docker定制简单的java-web应用镜像 网址: 1.jdk下载网址:https://www.oracle.com/technetwork/java/javase/downloads/jdk ...

  3. 【记录】linux docker 安装 tomcat

    前言:首先linux需要先安装docker,具体步骤可以参考博主之前博客,也可自行百度. 话不多说,开始安装tomcat: 通过docker安装tomcat docker pull tomcat:8. ...

  4. Docker安装tomcat和部署项目

    随着微服务的流行,Docker越来越流行,正如它的理念"Build, Ship, and Run Any App, Anywhere"一样,Docker提供的容器隔离技术使得开发人 ...

  5. Docker安装Tomcat镜像并部署web项目

    一.安装Tomcat 1.查找Docker Hub上的tomcat镜像 docker search tomcat 2.拉取官方的镜像 docker pull tomcat 等待下载完毕,需要一些时间. ...

  6. docker安装tomcat

    先在官网上找可用的镜像 我使用的是7-jre8 获取tomcat镜像的命令:$docker pull tomcat:7-jre8 获取完镜像以后,通过命令可以列举出已有的镜像: 列举镜像的命令:$do ...

  7. docker安装Tomcat软件,部署项目

    1 搜索tomcat镜像 $ sudo docker search tomcat NAME DESCRIPTION STARS OFFICIAL AUTOMATED tomcat Apache Tom ...

  8. 在docker安装tomcat的时候,报错:Caused by: java.lang.IllegalArgumentException: The AJP Connector is configured with secretRequired="true

    初识docker,试着在docker中安装tomcat(安装的tomcat8.5),并且挂载到宿主机的相关目录下,结果启动的时候报错: 12-May-2020 01:14:34.061 SEVERE ...

  9. 使用docker安装tomcat服务

    1. 拉取官方tomcat镜像 docker pull tomcat 2. 创建tomcat容器目录 [root@WSyHRQ171356 /]# mkdir /tomcat/test 3. 创建测试 ...

  10. docker 安装tomcat容器和mysql容器

    1. docker pull mysql:5.6 2.docker run -p 3306:3306 --name mysql -v /data/mysql/conf:/etc/mysql/conf. ...

随机推荐

  1. 并发bug之源(二)-有序性

    什么是有序性? 简单来说,假设你写了下面的程序: int a = 1; int b = 2; System.out.println(a); System.out.println(b); 但经过编译器/ ...

  2. 基于python的数学建模---运输问题

    代码 import pulp import numpy as np from pprint import pprint def transport_problem(costs, x_max, y_ma ...

  3. 基于LSM树的存储机制简述

    下午听了关于MyRocks-PASV的研究讲座,很有意思所以学习了一下LSM树的一些简单的底层原理.现在整理一下 我们都知道目前Key:Value型的数据库普遍较之关系型数据库有着更好的表现,为什么会 ...

  4. day15 Socket网络编程 & 反射

    day15 知识点浅记一下 ping 使用来icmp来检查网络是否连通,并没有记录路径.  tracert 使用icmp包记录并确定数据包访问目标所经过的路由,因此可以依据此命令判断故障发生的位置 n ...

  5. 打印九九乘法表,打印金字塔-java

    /** * *** ***** 打印如图金字塔 *=i*2-1 (竖)空格数=列数-1 */ public class Circulate{ public static void main(Strin ...

  6. C++编程笔记(通信)(win32平台)

    目录 一.初始化网络库 二.socket套接字 2.1服务端 2.2客户端 三.发送.接收数据 3.1发送 3.2接收数据 四.自定义的结构体 4.1 发送端 4.2接收端 IPV6版本套接字的创建 ...

  7. Blazor Server完美实现Cookie Authorization and Authentication

    Blazor server-side application用Microsoft.AspNetCore.Identity.EntityFrameworkCore实现Authorization 和 Au ...

  8. 【Spark】Day01-入门、模块组成、4种运行模式详解及配置、案例实操(spark分析过程)

    一.概述 1.概念 基于内存的大数据分析计算引擎 2.特点 快速.通用.可融合性 3.Spark内置模块[腾讯8000台spark集群] Spark运行在集群管理器(Cluster Manager)上 ...

  9. python多线程批量操作交换机

    import time import socket import threading def device_info(): ip_list = [] name_list = [] user_list ...

  10. JS基本数据类型——BigInt

    一.JS基本数据类型--BigInt BigInt是ES11引入的新的基本数据类型.BigInt数据类型的目的是比Number数据类型支持的范围更大的整数值,以任意精度表示整数.使用 BigInt解决 ...