Docker运行:控制台上未显示日志

时间:2016-07-28 05:54:03

标签: logging docker

以下是Dockerfile

FROM centos:centos6
MAINTAINER Priyanka

################## Helpful utils
RUN yum -y install sudo
RUN yum -y install curl
RUN yum -y install unzip

################## JDK7

#Note that ADD uncompresses this tarball automatically
ADD jdk-7u79-linux-x64.tar.gz /opt
WORKDIR /opt/jdk1.7.0_79
RUN alternatives --install /usr/bin/java java /opt/jdk1.7.0_79/bin/java 1
RUN alternatives --install /usr/bin/jar jar /opt/jdk1.7.0_79/bin/jar 1
RUN alternatives --install /usr/bin/javac javac /opt/jdk1.7.0_79/bin/javac 1
RUN echo "JAVA_HOME=/opt/jdk1.7.0_79" >> /etc/environment
ENV JAVA_OPTS -Xms1024m -Xmx4196m -XX:NewSize=256m -XX:MaxNewSize=356m -XX:PermSize=256m -XX:MaxPermSize=356m

RUN curl -O http://10.113.57.164:8080/job/ROC4-Server-UT-enabled/ws/roc-server-bootstrap/target/bootstrap.zip
RUN unzip bootstrap.zip -d /usr/share/server
RUN chmod +x /usr/share/server/bootstrap/bin/bootstrap.sh
CMD ["/usr/share/server/bootstrap/bin/bootstrap.sh","run"]

以下是使用的泊坞窗命令:

docker build -t serdock9 .

docker run -v /priyanka_docker/configserver.properties:/usr/share/server/bootstrap/config/configserver.properties serdock9 /bin/bash

Docker构建成功运行。 当我执行Docker运行时,该命令会执行,但不会在控制台上显示任何日志。 在哪里,当我手动运行时,相同的bootstrap.sh显示一组日志。 知道应该更新日志的内容,因为我无法确定没有它们的Docker运行状态。

1 个答案:

答案 0 :(得分:1)

因为您的Dockerfile有一行

CMD ["/usr/share/server/bootstrap/bin/bootstrap.sh","run"]

这意味着一个

docker run -v aaa:bbb serdock9

将启动此脚本

启动时

docker run -v aaa:bbb serdock9 /bin/bash

用/ bin / bash替换你的CMD,它不会显示任何内容

另见

https://hub.docker.com/r/k3ck3c/nethogs/

提取

I define an alias alias nethogs='docker run -it --net=host --rm k3ck3c/nethogs' so just nethogs will monitor wlan0 and nethogs eth0 will monitor eth0 (or accordingly ra1, or...)