0

I am trying to pass in an alternate argument to my ENTRYPOINT. Here is a basic example:

% cat Dockerfile
FROM ubuntu:latest
ENTRYPOINT ["date"]
CMD ["-u"]

% docker run -it my-app    
Wed Sep 22 18:49:54 UTC 2021

% docker run -it my-app -r1
date: 1: No such file or directory

I am using date as a toy example. Why when I pass in -r1 does it fail? I have tried to put quotes around it and escape, but I can't seem to get this basic example to work.

Brian Feeny
  • 441
  • 4
  • 14
  • Does this answer your question? [What is the difference between CMD and ENTRYPOINT in a Dockerfile?](https://stackoverflow.com/questions/21553353/what-is-the-difference-between-cmd-and-entrypoint-in-a-dockerfile) – CloudBalancing Sep 22 '21 at 19:33
  • 2
    the `-r` flag takes the date from a file, you've given it `1` and date complains that it can't find that file. Use `--entrypoint` to override entrypoint. What you're doing now it overriding `CMD`. – micke Sep 22 '21 at 19:49
  • 1
    Also compare [Ubuntu's date(1) man page](https://manpages.ubuntu.com/manpages/xenial/man1/date.1.html) with [OpenBSD's date(1) man page](https://man.openbsd.org/date.1); the `date -r` option has different meanings. – David Maze Sep 22 '21 at 21:36

1 Answers1

0

The issue was I was using "man date" on my OS X machine and I thought -r was passing number of seconds since Epoch. But -r as @micke pointed out has a different purpose in Ubuntu, so "-r1" does not make sense.

Brian Feeny
  • 441
  • 4
  • 14