pythonic
pythonic

Reputation: 21665

About the syntax of Docker build

I am learning docker at the moment. From https://docs.docker.com/engine/reference/commandline/build/#text-files, I learnt that the syntax to build an image from a docker file is docker build - < Dockerfile. I tried it and it worked, but I am bit confused about the purpose of - here. I know that < is for redirection, but what does - mean here? What does it mean in Linux?

Upvotes: 0

Views: 56

Answers (2)

Marged
Marged

Reputation: 10973

Many applications that expect a filename as parameter allow you to specify - and use stdin or stdout instead.

In your scenario I would say this only introduces complexity: use the dockerfile directly

Upvotes: 2

Oliver Charlesworth
Oliver Charlesworth

Reputation: 272752

Many *nix programs interpret a filename argument of - to mean "from stdin". Examples include cat, head, and md5sum.

It's just a convention, though. There's no special magic going on here.

Upvotes: 2

Related Questions