本トピックには、Hello World Docker デモンストレーションの Dockerfile ファイルのリストおよび説明が含まれています。Dockerfile 全体をリストし、Dockerfile に含まれる各コマンドの説明をその後の表にまとめてあります。Dockerfile のリストに示してある行番号は、読みやすくするために追加したものです。付属の Dockerfile には記載されていません。
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. 004 005 # use the -build image, as we are using msbuild 006 ARG MFPRODBASE= 007 ARG DTAG= 008 FROM microfocus/vcbuildtools-build:${DTAG} as build-env 009 010 LABEL com.microfocus.is-example="true" 011 ARG Config=Release 012 013 # Copy the src folder to c:\src in the container 014 COPY src "c:\\src" 015 WORKDIR "c:\\src" 016 017 # Build the source using the msbuild project file with a output directory of c:\app 018 ARG Platform=x86 019 ENV BLDPlatform ${Platform} 020 ENV BLDConfig ${Config} 021 RUN msbuild /p:OutDir=c:\app /p:Configuration=%BLDConfig%;Platform=%BLDPlatform% HelloWorld.sln 022 023 # Build runtime image for development or production 024 FROM ${MFPRODBASE} 025 WORKDIR "c:\\app" 026 027 # Copy the c:\app folder from the build-env step 028 COPY --from=build-env "c:\\app" "c:\\app" 029 ENTRYPOINT ["HelloWorld.exe"]
この Dockerfile の各行のコマンドは次のとおりです。