Ken_McDonald
Mission Specialist
Mission Specialist
  • 2,412 Views

Is there Dockerfile format or example in RHEL man page or elsewhere in an OS install?

Jump to solution

Can I find Dockerfile format structure (keywords, examples, etc) in a standalone RHEL OS installation? So that during a certification test I could lookup the format if I forget something. I know many OS commands have stuff like "man 5 command" to get their config file structure details, but I cannot seem to find anything like that for a Dockerfile or Containerfile

Labels (4)
3 Solutions

Accepted Solutions
Fran_Garcia
Flight Engineer Flight Engineer
Flight Engineer
  • 2,391 Views

This is valid for any type of file you might need, so take your peek :)

 

# yum provides "**/Dockerfile"

# yum install buildah-tests  (for example)

 

View solution in original post

flozano
Moderator
Moderator
  • 2,379 Views

AFAIK RHEL8 man pages provide no example and no explanation of the syntax of Dockerfile, just like RHEL8 gcc package provides no tutorial on the C programming language.

But you can find a few examples of Dockerfiles and recommended practices in the "Building, running, and managing containers" guide from RHEL8 at

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/building_runnin...

View solution in original post

Ken_McDonald
Mission Specialist
Mission Specialist
  • 1,076 Views

I come back to this post about a year later, and there are so many additional great suggestions on this Q. Thanks so much for sharing!

View solution in original post

7 Replies
Fran_Garcia
Flight Engineer Flight Engineer
Flight Engineer
  • 2,392 Views

This is valid for any type of file you might need, so take your peek :)

 

# yum provides "**/Dockerfile"

# yum install buildah-tests  (for example)

 

Ken_McDonald
Mission Specialist
Mission Specialist
  • 2,369 Views

Thanks @Fran_Garcia !!! That is exactly the kind of info I needed. Never really thought to globally search the repositories for example files. That'll help a lot in case I forget a keyword or syntax in a closed-off cert test lab environment

flozano
Moderator
Moderator
  • 2,380 Views

AFAIK RHEL8 man pages provide no example and no explanation of the syntax of Dockerfile, just like RHEL8 gcc package provides no tutorial on the C programming language.

But you can find a few examples of Dockerfiles and recommended practices in the "Building, running, and managing containers" guide from RHEL8 at

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/building_runnin...

JS_Learning
Moderator
Moderator
  • 2,146 Views

Hi,

As @Ken_McDonald highlighted in the OP, it's also "during a certification test".

About the 2 alleged solutions, I hope we can find something else...

1) Looking up any existing Dockerfile might work, it's time consuming and many files don't have the exact syntax as example. Let's say that during an official test, it took me easily 10-15 minutes (which was 12%-18% of the total exam time) to find some example remotely relevant. And now, comparing with results found in the internet in approximately 1 minutes, I probably got the syntax wrong. That's even stranger because I tried two versions during the exam (wasting additional precious time) and the one I selected was able to "start a process", as proven by podman logs.

2) The second one required to install "buildah-tests  ", which might or might not have any example files. Beside finding some Dockerfile files, I have no indication what to look for, possibly having to browse through several files again. Also, the size is rather consequent with the dependencies:  Installed size: 576 M.... Having to install many packages + consequent amount of data for what could be a single man page or example file seems way over the top. At least on operational level and/or real world conditions.

 

Unfortunately, the online page quoted above, does not contain the type of CMD related example one would need (to complete a specific given task during an exam): 

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/building_runnin... 

 

I will keep looking for an alternative solution.

 

 

tat
Flight Engineer Flight Engineer
Flight Engineer
  • 1,998 Views

man -k dockerfile

leads to:

Dockerfile(5)

which shows all the possible syntax.

 

If Dockerfile(5) man pages are not installed, you can check what to install with:

yum provides "*man?/Dockerfile*"

 

Also, the provided RHEL8 Documentation link shows CMD examples eg in "6.5. BUILDING AN UBI-BASED IMAGE".

(In an RHexam, try to open Docs as pdf with evince. This leads to better performance and enables you to search the whole Doc)

 

 

best regards,
Alexander
tat
Flight Engineer Flight Engineer
Flight Engineer
  • 1,990 Views

Also the "s2i" (source-to-image from rhel-server-rhscl-7-rpms) tool might help A LOT.

Just invoke it like:

s2i create name dir

and you should have a perfect ocp-style dockerfile in ./dir/Dockerfile

best regards,
Alexander
Ken_McDonald
Mission Specialist
Mission Specialist
  • 1,077 Views

I come back to this post about a year later, and there are so many additional great suggestions on this Q. Thanks so much for sharing!

Join the discussion
You must log in to join this conversation.