-1

I need to build an image on an application for CentOS7 . Following the docker documentation I have performed following steps:

  1. Installed docker on my centos7 machine
  2. Created new folder

Now I want to start writing the docker file for application xyz. My questions are :

  1. Do I need to create a new file name xyz.dockerfile ( touch xyz.dockerfile and them vim ) and then start writing a command ? or simple create a new dockerfile ( touch dockerfile)

  2. How can I display comments while for multiple operations while executing this dockerfile ?

  3. What will be CMD parameters if first task I need to perform is download yum repository ( rpm -ivh abc.rpm) in my dockerfile?

Any help will be appreciated. Thank you.

HellBoy13
  • 3
  • 1
  • 3
  • Saw this: https://stackoverflow.com/questions/50042514/what-is-the-dockerfile-extension/50867386 , it seems Dockerfile doesn't have any extension – HellBoy13 May 29 '20 at 07:50
  • Looked into this thread : https://stackoverflow.com/questions/26077543/how-to-name-dockerfiles?rq=1 – HellBoy13 May 29 '20 at 08:07
  • Docker's [Build and run your image](https://docs.docker.com/get-started/part2/) tutorial might be a good starting point. That includes a sample `Dockerfile` (exactly that name, no extension, capital "D"), with comments. The Docker documentation also has some [Samples](https://docs.docker.com/samples/) that might give you some ideas for typical patterns. – David Maze May 29 '20 at 10:00
  • You can build a `Dockerfile` with any name and/or extension as long as you pass the `-f` flag which specifies to the `docker build` command which file(s) to build from. – hdhruna May 30 '20 at 06:33

1 Answers1

0

Thank you @DavidMaze and @hdhruna for your help.

so for my first question, I understood that dockerfile doesn't have any extension. I have looked into various links :

How to name Dockerfiles

What is the .dockerfile extension?

it was helpful

HellBoy13
  • 3
  • 1
  • 3