ChocoDeveloper
ChocoDeveloper

Reputation: 14578

How can I copy a config file within a Dockerfile?

I'm trying to install and configure nginx among other things, but I need to copy an entire config file. I tried simply adding it to the Dockerfile since it's just a few lines, but Dockerfile doesn't seem to have good support for multiline commands. I mean I need to copy my config file as is, I can't pollute it with 'sed', 'cat', or '\' on every line.

Some people suggested placing the config file in a public git repository, and I guess I can do that if it turns out there is no other way. But I don't like it at all because it doesn't make sense. I don't want to have and manage version control repositories for these files (let alone make them public), I just want to copy/paste them. They are very simple!

Any ideas?

Upvotes: 2

Views: 13351

Answers (1)

Ben Whaley
Ben Whaley

Reputation: 34416

You should use the ADD instruction in your Dockerfile to copy the config file into the container.

Upvotes: 6

Related Questions