您正在使用docker文件下方构建图片。它运行的maven剧本完美但是当开始运行声纳游戏书时,它被绞死并且没有任何反应。只有在剧本中的声音是声纳剧本重新开始声明。可以解决问题的原因。我测试了每个剧本,每个剧本都在里面运行容器。 是否可以将容器日志并排查看为构建映像时所有ansible正在执行的操作。截至目前,Docker仅在完成步骤时才会发送日志。
FROM xyz.com/akathaku/cidemo:latest
MAINTAINER akathaku <akathaku@gmail.com>
USER root
ENV SCPATH /etc/supervisor/conf.d
ENV PLAYBOOKS /ansible
# RUN yum -y update
# The daemons
RUN yum -y install supervisor
RUN mkdir -p /var/log/supervisor
# Supervisor Configuration
ADD ./supervisord/conf.d/* $SCPATH/
#Running ansible
ADD ./sonar-playbook $PLAYBOOKS/sonar-playbook
ADD ./maven-playbook $PLAYBOOKS/maven-playbook
ADD ./jenkins-playbook $PLAYBOOKS/jenkins-playbook
ADD ./tomcat-playbook $PLAYBOOKS/tomcat-playbook
WORKDIR $PLAYBOOKS
RUN ansible-playbook $PLAYBOOKS/sonar-playbook/sonar.yml -c local
RUN ansible-playbook $PLAYBOOKS/maven-playbook/maven.yml -c local
RUN ansible-playbook $PLAYBOOKS/jenkins-playbook/jenkins.yml -c local
RUN ansible-playbook $PLAYBOOKS/tomcat-playbook/tomcat.yml -c local
# Application Code
CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisor.conf"]
EXPOSE 8080 8081 9000 9001 8086
以下是泊坞窗运行的输出
Step 1 : FROM xyz.com/akathaku/cidemo:latest
---> d477ceab5d3b
Step 2 : MAINTAINER akathaku <akathaku@gmail.com>
---> Using cache
---> a9c3c191aabd
Step 3 : USER root
---> Using cache
---> 24a18ddc6f49
Step 4 : ENV SCPATH /etc/supervisor/conf.d
---> Using cache
---> ea6f4dada89c
Step 5 : ENV PLAYBOOKS /ansible
---> Using cache
---> 9d42760dc51f
Step 6 : RUN yum -y install supervisor
---> Using cache
---> 7af486ce2a8c
Step 7 : RUN mkdir -p /var/log/supervisor
---> Using cache
---> a1b1c145d490
Step 8 : ADD ./supervisord/conf.d/* $SCPATH/
---> Using cache
---> f16e32135351
Step 9 : ADD ./sonar-playbook $PLAYBOOKS/sonar-playbook
---> 170c1dc82ffa
Removing intermediate container bfa474ef9d11
Step 10 : ADD ./maven-playbook $PLAYBOOKS/maven-playbook
---> 90a57735fe3b
Removing intermediate container b5f7bbb3b85d
Step 11 : ADD ./jenkins-playbook $PLAYBOOKS/jenkins-playbook
---> 09ab0f929f45
Removing intermediate container 7dc62423354d
Step 12 : ADD ./tomcat-playbook $PLAYBOOKS/tomcat-playbook
---> 13c3bb5f7aca
Removing intermediate container 4356605f503a
Step 13 : WORKDIR $PLAYBOOKS/maven-playbook
---> Running in 34867677f4e1
---> f48ffe4115db
Removing intermediate container 34867677f4e1
Step 14 : RUN ansible-playbook maven.yml -c local
---> Running in 4eda53bf7e00
PLAY [localhost] **************************************************************
GATHERING FACTS ***************************************************************
ok: [localhost]
TASK: [maven | Install Java 1.8 JRE] ******************************************
changed: [localhost]
TASK: [maven | Install Java 1.8 JDK] ******************************************
changed: [localhost]
TASK: [maven | lineinfile dest='/etc/profile' regexp='^#?\s*export JAVA_HOME=(.*)$' line='export JAVA_HOME=/usr/lib/jvm/java-openjdk' state=present] ***
changed: [localhost]
TASK: [maven | lineinfile dest=/etc/profile regexp='^#?\s*export PATH=(.*)JAVA_HOME(.*)$' line="export PATH=$PATH:$JAVA_HOME/bin" state=present] ***
changed: [localhost]
TASK: [maven | Reload profile] ************************************************
changed: [localhost]
TASK: [maven | Download Apache Maven] *****************************************
changed: [localhost]
TASK: [maven | Untar Maven to /opt] *******************************************
changed: [localhost]
TASK: [maven | Create symbolic link maven to the /opt/apache-{{ maven_version }}] ***
changed: [localhost]
TASK: [maven | lineinfile dest=/etc/profile regexp='^#?\s*export MAVEN_HOME=(.*)$' line='export MAVEN_HOME=/opt/maven' state=present] ***
changed: [localhost]
TASK: [maven | lineinfile dest=/etc/profile regexp='^#?\s*export PATH=(.*)MAVEN_HOME(.*)$' line="export PATH=$PATH:$MAVEN_HOME/bin" state=present] ***
changed: [localhost]
TASK: [maven | Reload profile] ************************************************
changed: [localhost]
TASK: [maven | Create local repository] ***************************************
changed: [localhost]
TASK: [maven | Creates setting.xml file] **************************************
changed: [localhost]
PLAY RECAP ********************************************************************
localhost : ok=14 changed=13 unreachable=0 failed=0
---> fb211f3fbbfd
Removing intermediate container 4eda53bf7e00
Step 15 : WORKDIR $PLAYBOOKS/sonar-playbook
---> Running in b9ba0623b48a
---> d48ad5abbf43
Removing intermediate container b9ba0623b48a
Step 16 : RUN ansible-playbook sonar.yml -c local
---> Running in 2d2716354c5d
答案 0 :(得分:1)
以下是您可以做的事情:
从直到结尾的行注释掉dockerfile。
构建映像,以交互方式启动新容器,然后直接从shell运行相同的行。这基本上相当于让它在docker build期间运行,只有你有机会也检查那台机器上发生的任何事情(你可以尾随日志,你可以docker exec
进入容器它挂了,弄清楚哪个过程被卡住等等。)