我想使用遵循docker文件作为学习 puppet 的基础。它的编写方式是运行一些 puppet 命令然后立即退出。
我试图了解容器在哪里关闭,以便我可以修改它以保持运行。Dockerfile 如下:
FROM ubuntu:16.04
MAINTAINER Gareth Rushgrove "[email protected]"
ENV PUPPET_AGENT_VERSION="1.8.3" UBUNTU_CODENAME="xenial"
LABEL org.label-schema.vendor="Puppet" \
org.label-schema.url="https://github.com/puppetlabs/puppet-in-docker" \
org.label-schema.name="Puppet Agent (Ubuntu)" \
org.label-schema.license="Apache-2.0" \
org.label-schema.version=$PUPPET_AGENT_VERSION \
org.label-schema.vcs-url="https://github.com/puppetlabs/puppet-in-docker" \
org.label-schema.vcs-ref="a2b1fbbc73177ddc3def23d167f9beb9c3ef9f6c" \
org.label-schema.build-date="2017-02-21T17:25:14Z" \
org.label-schema.schema-version="1.0" \
com.puppet.dockerfile="/Dockerfile"
RUN apt-get update && \
apt-get install --no-install-recommends -y wget ca-certificates lsb-release && \
wget https://apt.puppetlabs.com/puppetlabs-release-pc1-"$UBUNTU_CODENAME".deb && \
dpkg -i puppetlabs-release-pc1-"$UBUNTU_CODENAME".deb && \
rm puppetlabs-release-pc1-"$UBUNTU_CODENAME".deb && \
apt-get update && \
apt-get install --no-install-recommends -y puppet-agent="$PUPPET_AGENT_VERSION"-1"$UBUNTU_CODENAME" && \
apt-get remove --purge -y wget && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
ENV PATH=/opt/puppetlabs/server/bin:/opt/puppetlabs/puppet/bin:/opt/puppetlabs/bin:$PATH
ENTRYPOINT ["/opt/puppetlabs/bin/puppet"]
CMD ["agent", "--verbose", "--onetime", "--no-daemonize", "--summarize" ]
COPY Dockerfile /
我该如何修改它以使其不会立即关闭?
答案1
我发现删除"--onetime"
以下几行:
ENTRYPOINT ["/opt/puppetlabs/bin/puppet"]
CMD ["agent", "--verbose", "--onetime", "--no-daemonize", "--summarize" ]
从我正在读什么该--onetime
选项改变触发退出的返回的退出代码。