From 3a33be132996f8477986a2dbbc8839cbbd27ab2a Mon Sep 17 00:00:00 2001 From: Wesley Coakley Date: Wed, 14 Apr 2021 20:48:59 -0400 Subject: [PATCH] docker: prefer CMD to ENTRYPOINT Specifying watchfrr as CMD instead of ENTRYPOINT allows one to easily override this command when starting a docker container. This allows simple, manual testing via (e.g.) bash. With ENTRYPOINT only the container will simply explode with an exit code if watchfrr exits. For instance one could start a shell session in this container via: ``` docker run --name test --rm -i -t bash ``` The default behavior (`docker run ` with no command specified) is not changed. Signed-off-by: Wesley Coakley --- docker/alpine/Dockerfile | 2 +- docker/centos-7/Dockerfile | 2 +- docker/centos-8/Dockerfile | 2 +- docker/debian/Dockerfile | 2 +- docker/debian/docker-start | 4 +++- docker/ubuntu18-ci/Dockerfile | 2 +- docker/ubuntu20-ci/Dockerfile | 2 +- 7 files changed, 9 insertions(+), 7 deletions(-) diff --git a/docker/alpine/Dockerfile b/docker/alpine/Dockerfile index 126710f8c2..69aa9c38a6 100644 --- a/docker/alpine/Dockerfile +++ b/docker/alpine/Dockerfile @@ -56,4 +56,4 @@ RUN apk add \ --allow-untrusted /pkgs/apk/*/*.apk \ && rm -rf /pkgs COPY docker/alpine/docker-start /usr/lib/frr/docker-start -ENTRYPOINT [ "/sbin/tini", "--", "/usr/lib/frr/docker-start" ] +CMD [ "/sbin/tini", "--", "/usr/lib/frr/docker-start" ] diff --git a/docker/centos-7/Dockerfile b/docker/centos-7/Dockerfile index a92326fcf3..d2ec9f974b 100644 --- a/docker/centos-7/Dockerfile +++ b/docker/centos-7/Dockerfile @@ -40,4 +40,4 @@ COPY --from=centos-7-builder /rpmbuild/RPMS/ /pkgs/rpm/ RUN yum install -y /pkgs/rpm/*/*.rpm \ && rm -rf /pkgs COPY docker/centos-7/docker-start /usr/lib/frr/docker-start -ENTRYPOINT [ "/usr/lib/frr/docker-start" ] +CMD [ "/usr/lib/frr/docker-start" ] diff --git a/docker/centos-8/Dockerfile b/docker/centos-8/Dockerfile index 7ed7948927..104501aabc 100644 --- a/docker/centos-8/Dockerfile +++ b/docker/centos-8/Dockerfile @@ -41,4 +41,4 @@ COPY --from=centos-8-builder /rpmbuild/RPMS/ /pkgs/rpm/ RUN yum install -y /pkgs/rpm/*/*.rpm \ && rm -rf /pkgs COPY docker/centos-8/docker-start /usr/lib/frr/docker-start -ENTRYPOINT [ "/usr/lib/frr/docker-start" ] +CMD [ "/usr/lib/frr/docker-start" ] diff --git a/docker/debian/Dockerfile b/docker/debian/Dockerfile index 3f830348bc..cc9217f103 100644 --- a/docker/debian/Dockerfile +++ b/docker/debian/Dockerfile @@ -17,4 +17,4 @@ RUN apt-get update && \ rm -rf /var/lib/apt/lists/* ADD docker-start /usr/sbin/docker-start -ENTRYPOINT ["/usr/sbin/docker-start"] +CMD ["/usr/sbin/docker-start"] diff --git a/docker/debian/docker-start b/docker/debian/docker-start index 43854ab142..a0f31f5ac5 100755 --- a/docker/debian/docker-start +++ b/docker/debian/docker-start @@ -7,4 +7,6 @@ set -e ## chown -R frr:frr /etc/frr /etc/init.d/frr start -exec sleep 10000d + +# Sleep forever +exec tail -f /dev/null diff --git a/docker/ubuntu18-ci/Dockerfile b/docker/ubuntu18-ci/Dockerfile index ac745c60a8..f6fa910381 100644 --- a/docker/ubuntu18-ci/Dockerfile +++ b/docker/ubuntu18-ci/Dockerfile @@ -68,4 +68,4 @@ RUN cd ~/frr && \ RUN cd ~/frr && make check || true COPY docker/ubuntu18-ci/docker-start /usr/sbin/docker-start -ENTRYPOINT ["/usr/sbin/docker-start"] +CMD ["/usr/sbin/docker-start"] diff --git a/docker/ubuntu20-ci/Dockerfile b/docker/ubuntu20-ci/Dockerfile index 56657789ee..0b08c2f278 100644 --- a/docker/ubuntu20-ci/Dockerfile +++ b/docker/ubuntu20-ci/Dockerfile @@ -71,4 +71,4 @@ RUN cd ~/frr && \ RUN cd ~/frr && make check || true COPY docker/ubuntu20-ci/docker-start /usr/sbin/docker-start -ENTRYPOINT ["/usr/sbin/docker-start"] +CMD ["/usr/sbin/docker-start"] -- 2.39.5