The Dockerfile File in the Hello World Docker Demonstration

This topic lists and describes the Dockerfile file from the Hello World Docker demonstration. The Dockerfile is listed in its entirety and a following table describes the various Dockerfile commands. The line numbers in the listings of the Dockerfile have been added to aid readability. They are not present in the supplied Dockerfile.

Note: The Dockerfiles supplied for Red Hat Linux and SUSE Linux differ slightly. The Dockerfile shown below is the one supplied with Red Hat Linux. Where there are differences between the two versions they are described in the following table.
001  # Copyright (C) Micro Focus 2018. All rights reserved. 
002  # This sample code is supplied for demonstration purposes only
003  # on an "as is" basis and is for use at your own risk. 
005  FROM microfocus/vcdevhub:rhel7_4.0_x64
007  LABEL"false"
009  RUN useradd -ms /bin/bash app
010  ADD HelloWorld.tar.gz /home/app/
012  USER app
013  WORKDIR /home/app
014  ENTRYPOINT ./HelloWorld

The commands on the lines in this Dockerfile are as follows:

Lines Description
005 Specifies the base image to use, which is the Visual COBOL base image.

On SUSE Linux the tag specified in the Dockerfile is sles12sp3_4.0_x64.

007 Specify the metadata labels for the image that will be created. These labels can be queried using the docker inspect command.
009 Runs the useradd command to add a new user called "app" with a login shell of /bin/bash.

On SUSE Linux, the corresponding action is achieved by a the RUN useradd and RUN chown commands on lines 9 and 10.

010 Copies the files for the Hello World application into the /home/app folder in the image's filesystem.

On SUSE Linux this command is on line 11.

012 - 014 Sets the user name to be used when running the image and specifies that running the image executes the Hello World application.

On SUSE Linux these commands are on lines 13 through 15.