10分钟,在centos7中安装docker并成功创建tomcat

直接上命令,具体如下(下载详细操作步骤):

[[email protected] ~]# mkdir docker

[[email protected] ~]# ls

docker

[[email protected] ~]# cd docker/

[[email protected] docker]# ls

[[email protected] docker]# yum list installed | grep docker

[[email protected] docker]# uname -r

3.10.0-957.27.2.el7.x86_64

[[email protected] docker]# systemctl start docker

[[email protected] docker]# docker -v

Docker version 1.13.1, build 7f2769b/1.13.1

[[email protected] docker]# systemctl enable docker

Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.

[[email protected] docker]#

[[email protected] docker]# docker pull tomcat:8.5.35

Trying to pull repository docker.io/library/tomcat ...

8.5.35: Pulling from docker.io/library/tomcat

54f7e8ac135a: Pull complete

d6341e30912f: Pull complete

087a57faf949: Pull complete

95065f220961: Pull complete

0887630ce576: Pull complete

c375d1959fab: Pull complete

e00a5e6055cc: Pull complete

8319f5fb56cf: Pull complete

258c74eb25ab: Pull complete

5c135322994c: Pull complete

b2cc25ec4861: Pull complete

40140bebba00: Pull complete

d1786b40ed4f: Pull complete

Digest: sha256:d6f67aacce64010880a1e9ea6f0ace9fe9e20d39aae0489c8e88b4c14effe3a0

Status: Downloaded newer image for docker.io/tomcat:8.5.35

[[email protected] docker]# docker images

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE

docker.io/tomcat    8.5.35              48dd385504b1        10 months ago       475 MB

[[email protected] docker]#

[[email protected] docker]# docker run --name tomcat8080 -d -p 8080:8080 48dd385504b1

dc9bdc3f0e34eb13586222ea2cecb03a3517660ca34cd20e933051f293f04f2e

[[email protected] docker]# docker ps

CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                    NAMES

dc9bdc3f0e34        48dd385504b1        "catalina.sh run"   47 seconds ago      Up 46 seconds       0.0.0.0:8080->8080/tcp   tomcat8080

[[email protected] docker]# docker  exec -it  tomcat8080   /bin/bash

[email protected]:/usr/local/tomcat# ls

BUILDING.txt     NOTICE         RUNNING.txt  include  native-jni-lib  work

CONTRIBUTING.md  README.md      bin          lib      temp

LICENSE          RELEASE-NOTES  conf         logs     webapps

[email protected]:/usr/local/tomcat# cd bin

[email protected]:/usr/local/tomcat/bin# ls

bootstrap.jar                 configtest.sh    startup.sh

catalina-tasks.xml            daemon.sh        tomcat-juli.jar

catalina.sh                   digest.sh        tool-wrapper.sh

commons-daemon-native.tar.gz  setclasspath.sh  version.sh

commons-daemon.jar            shutdown.sh

[email protected]:/usr/local/tomcat/bin# ./startup.sh &

[1] 60

[email protected]:/usr/local/tomcat/bin# Tomcat started.

在浏览器输入 IP:8080 就可访问默认的 Tomcat 界面了。

10分钟,在centos7中安装docker并成功创建tomcat

 

详细操作手册下载地址