方法一、docker pull tomcat
查找 Docker Hub 上的 Tomcat 镜像:
The latest MySQL 8.0 version is available to install from the default AppStream repository using the MySQL module that is enabled by default on the CentOS 8 and RHEL 8 systems. There is also MariaDB 10.3 database version is available to install from the default AppStream repository, which is “ drop-in replacement ” for MySQL 5.7, with some. Debian is a Linux distribution that's composed entirely of free and open-source software. Improve this doc Balena base images. Balenalib is the central home for 26000+ IoT focused Docker images built specifically for balenaCloud and balenaOS.This set of images provide a way to get up and running quickly and easily, while still providing the option to deploy slim secure images to the edge when you go to production. This tutorial provides a starting point on how to install Docker, create and run Docker containers on CentOS/RHEL 8/7, but barely scratches the surface of Docker. Step 1: Install and Configure Docker. Earlier versions of Docker were called docker or docker-engine, if you have these installed, you must uninstall them before installing a newer. In this section, we will show you how to use Docker on your Raspberry Pi 4. If you have never used Docker, this section should help you get started. To run a Docker container, you need a Docker image on which the Docker container will be based. There are thousands of Docker containers available in the Docker container registry (Docker Hub).
可以通过 Sort by 查看其他版本的 tomcat,默认是最新版本 tomcat:latest。
此外,我们还可以用 docker search tomcat 命令来查看可用版本:
这里我们拉取官方的镜像:
等待下载完成后,我们就可以在本地镜像列表里查到 REPOSITORY 为 tomcat 的镜像。
方法二、通过 Dockerfile 构建
创建Dockerfile
首先,创建目录tomcat,用于存放后面的相关东西。
webapps 目录将映射为 tomcat 容器配置的应用程序目录。
logs 目录将映射为 tomcat 容器的日志目录。
conf 目录里的配置文件将映射为 tomcat 容器的配置文件。
进入创建的 tomcat 目录,创建 Dockerfile。
通过 Dockerfile 创建一个镜像,替换成你自己的名字:
创建完成后,我们可以在本地的镜像列表里查找到刚刚创建的镜像:
使用 tomcat 镜像
运行容器
命令说明:
Docker Install Debian 8.1
-p 8080:8080:将主机的 8080 端口映射到容器的 8080 端口。
-v $PWD/test:/usr/local/tomcat/webapps/test:将主机中当前目录下的 test 挂载到容器的 /test。
查看容器启动情况
Docker.io Install Debian 8
通过浏览器访问