Docker 创建安装了tomcat的镜像

docker 创建安装有tomcat的镜像,流程为:先下载镜像,用镜像启动容器,在容器中安装tomcat后保存安装了tomcat容器为新镜像。

docker 下载镜像的方式有很多,比如

sudo docker pull ubuntu:14.04

其中14.04表示ubuntu的镜像标签,如果不加标签,docker会自动下载latest标签的镜像

通过run命令用镜像启动一个容器

docker run -i -t ubuntu:14.04 /bin/bash 
或使用
docker run -i -t --name test ubuntu:14.04 /bin/bash 

以便在容器启动的时候指定容器的名称。

然后就可以在容器中安装tomcat 了。

具体安装方式,我这里提供一个较为完整的从镜像的下载到tomcat的安装的一篇文章

链接:http://www.21ops.com/linux/29783.html

这里有点需要注意的是,文章中用的镜像并不是ubuntu:14.04 , 如使用ubuntu:14.04可能会出现一下问题:

1、安装完ssh 并使用ssh登录 (~$  ssh root@127.0.0.1 -p 49154)的时候,会出现 Permission denied please try again.的错误

      此错误网上提供的解决方案有很多。具体分三类如下

a、修改/etc/ssh/sshd-config文件,将其中的PermitRootLogin no修改为yes,PubkeyAuthentication yes修改为no,AuthorizedKeysFile     .ssh/authorized_keys前面加上#屏蔽掉,PasswordAuthentication no修改为yes

b、修改/etc/ssh/sshd-config文件,将其中的PermitRootLogin 、PubkeyAuthentication 、PasswordAuthentication 修改为yes

c、修改/etc/ssh/sshd-config文件,将其中的PermitRootLogin 、PasswordAuthentication 修改为yes

我看了我自己的这个文件,由于PubkeyAuthentication 是yes 所以我就将PermitRootLogin 、PasswordAuthentication修改成 yes便可登陆,具体可根据情况自行选择。

2、在安装

apt-get install python-software-properties
add-apt-repository ppa:webupd8team/java

第二步的时候出现:ubuntu add-apt-repository: command not found. 的错误

      网上提供的解决方案是:

在安装

sudo apt-get install python-software-properties
之后 加 安装

sudo apt-get install software-properties-common
然后再进行这一步

add-apt-repository ppa:webupd8team/java
即可。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值