docker—tomcat 报错:Failed to get D-Bus connection: Operation not permitted
docker search centos 查系统镜像
docker pull docker.io/centos
进入容器
[root@git opt]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/tomcat8 latest 37e6b19c14e0 hours ago MB
gitalb-zh latest dd61a1ec3cdc days ago 1.72 GB
docker.io/twang2218/gitlab-ce-zh latest 1f71f185271a days ago 1.63 GB
docker.io/centos latest 2d194b392dd1 weeks ago MB
docker run -it docker.io/centos /bin/bash
安装tomcat
yum -y install tomcat......
代码路径: /usr/share/tomcat/webapps/ROOT/index.jsp
配置文件路径: /usr/share/tomcat/
把装好tomcat容器,生成镜像
[root@git opt]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a9717660d785 docker.io/tomcat8 "/usr/sbin/init" About an hour ago Up About an hour 0.0.0.0:888->8080/tcp tomcat8
[root@git opt]# docker commit a9717660d785 docker.io/tomcat8
用新镜像生成容器进行访问
[root@git opt]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/tomcat8 latest 37e6b19c14e0 26 hours ago 517 MB
gitalb-zh latest dd61a1ec3cdc 2 days ago 1.72 GB
docker.io/twang2218/gitlab-ce-zh latest 1f71f185271a 11 days ago 1.63 GB
docker.io/centos latest 2d194b392dd1 2 weeks ago 195 MB
docker run -itd -p 888:8080 --privileged=true --name tomcat8 docker.io/tomcat8 /usr/sbin/init (注:参数-d 是后台运行) 结尾如果 /bin/bash 进入容器后无法启动服务,报错:Failed to get D-Bus connection: Operation not permitted
据说是centos7的BUG
所以这里需 /usr/sbin/init 进入容器后可以使用systemctl 命令
因为这样会把宿主机的dbus服务带入容器启动 [root@a9717660d785 /]# ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 07:38 ? 00:00:00 /usr/sbin/init
root 17 1 0 07:38 ? 00:00:00 /usr/lib/systemd/systemd-journald
root 27 1 0 07:38 ? 00:00:00 /usr/sbin/sshd -D
dbus 28 1 0 07:38 ? 00:00:00 /bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
root 29 1 0 07:38 ? 00:00:00 /usr/lib/systemd/systemd-logind
如果想进入:
[root@git opt]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a9717660d785 docker.io/tomcat8 "/usr/sbin/init" About an hour ago Up About an hour 0.0.0.0:888->8080/tcp tomcat8
[root@git opt]# docker exec -it a9717660d785 bash
访问看效果:


docker—tomcat 报错:Failed to get D-Bus connection: Operation not permitted的更多相关文章
- 巨坑npm run dev 报错 终于找到正确答案 Error: EPERM: operation not permitted, open '/data/public/build/css/add.p
Windows10环境 npm run dev 报错 终于找到正确答案 Error: EPERM: operation not permitted, open '/data/public/build ...
- docker pull报错failed to register layer: Error processing tar file(exit status 1): open permission denied
近来在一个云主机上操作docker pull,报错如下: failed to register layer: Error processing ): open /etc/init.d/hwclock. ...
- Docker 内pip安装package报错: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'
说来奇幻(对本菜来说, 经常遇到堪称奇幻的问题) 之前在docker里面各种安装都没问题, 也不知道什么引起的, 昨天晚上调试的时候卸载了一个包的版本,然后就安不上了. 宿主机安装依然各种流畅,唯独d ...
- maven发布到tomcat报错: Publishing failed Could not publish to the server. java.lang.IndexOutOfBoundsException
eclipse中将maven项目发布到tomcat报错时: Publishing failed Could not publish to the server. java.lang.IndexOutO ...
- Tomcat报错: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/myApp]]
Tomcat报错:严重: A child container failed during startjava.util.concurrent.ExecutionException: org.apach ...
- 第一次安装tomcat报错,出现failed to install tomcat8 service错误
第一次安装tomcat报错,出现failed to install tomcat8 service错误(0) 一.一般情况下这种错误都是没有卸载干净造成的,安全卸载Tomcat的方法 (转载); ht ...
- docker启动报错iptables failed: -重建docker0网络恢复
# docker启动报错 [root@localhost mysqlconf]# docker run -d -p 8080:8080 --link zookeeper:zookeeper -e du ...
- tomcat运行报错Failed to start component [StandardEngine[Catalina].StandardHost[localhost].
tomcat运行报错Failed to start component [StandardEngine[Catalina].StandardHost[localhost].多半情况是找不到jar包 解 ...
- junit单元测试报错Failed to load ApplicationContext,但是项目发布到tomcat浏览器访问没问题
junit单元测试报错Failed to load ApplicationContext,但是项目发布到tomcat浏览器访问没问题,说明代码是没问题的,配置也没问题.开始时怀疑是我使用junit版本 ...
随机推荐
- 创建node节点的kubeconfig文件
创建node节点的kubeconfig文件 1.创建TLS Bootstrapping Token export BOOTSTRAP_TOKEN=$(head -c 16 /dev/urandom | ...
- 定义一个javascript库的兼容标准
1. 定义一个库的兼容标准, 比如说是ie6+? 还是ie8+? 还是ie9.2. 原生知识储备,至少你不完整的读过一个库的代码.3. DOM操作和事件上的问题更多的是hack技巧,并不是算法,也不是 ...
- springboot启动端口占用问题,报错org.apache.catalina.LifecycleException: Protocol handler start failed
解决办法,找到被占用的端口
- python之multiprocessing多进程
multiprocessing 充分利用cpu多核一般情况下cpu密集使用进程池,IO密集使用线程池.python下想要充分利用多核CPU,就用多进程. Process 类Process 类用来描述一 ...
- 测试Random类nextInt()方法连续两次结果一样的概率
public static void main(String[] args) { int count = 0; int a = 0; Random r = new Random(); while (t ...
- jenkins自动部署代码到多台服务器
下面讲一下如何通过一台jenkins服务器构建后将代码分发到其他的远程服务器,即jenkins自动部署代码到多台服务器. 1.下载 pulish over ssh 插件 2.系统管理 -> 系统 ...
- HashMap原理探究
一.写随笔的原因:HashMap我们在平时都会用,一般面试题也都会问,借此篇文章分析下HashMap(基于JDK1.8)的源码. 二.具体的内容: 1.简介: HashMap在基于数组+链表来实现的, ...
- 关于Linux单机、集群部署FastDFS分布式文件系统的步骤。
集群部署:2台tarcker服务器,2台storage服务器. 192.168.201.86 ---------(trackerd+storage+nginx) 192.168.201.87 ...
- 牛客假日团队赛10 L 乘积最大 (dp,大数)
链接:https://ac.nowcoder.com/acm/contest/1072/L?&headNav=acm&headNav=acm 来源:牛客网 乘积最大 时间限制:C/C+ ...
- npoi 导入
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CusImport.aspx ...