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 <frr-container> bash
```

The default behavior (`docker run <frr-container>` with no command
specified) is not changed.

Signed-off-by: Wesley Coakley <wcoakley@nvidia.com>
This commit is contained in:
Wesley Coakley 2021-04-14 20:48:59 -04:00
parent 861ea6f268
commit 3a33be1329
No known key found for this signature in database
GPG Key ID: 1812D90223E9C96D
7 changed files with 9 additions and 7 deletions

View File

@ -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" ]

View File

@ -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" ]

View File

@ -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" ]

View File

@ -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"]

View File

@ -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

View File

@ -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"]

View File

@ -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"]