Tools, FAQ, Tutorials:
Path Name Used to Build Windows Images
What is the format for path names used to build Windows Docker images? Is it different than Linux path name format?
✍: FYIcenter.com
Yes. Path name format used to build Windows images is different
from Linux images.
There are 2 general rules you have to remember when using path names in the Dockerfile to build Windows images.
1. When using path names as arguments for Windows programs, you need to use the "C:\bla\bla" Windows format.
2. When using path names as destinations of the COPY instruction, you need to use the "C:/bla/bla" Linux format.
Here is Dockerfile example, JavaImage, that uses path names:
C:\fyicenter> type JavaImage FROM openjdk RUN PowerShell mkdir C:\fyicenter COPY Hello.java C:/fyicenter/Hello.java RUN javac C:\fyicenter\Hello.java ENTRYPOINT java -cp C:\fyicenter Hello
Build and run it.
C:\fyicenter> docker build --file JavaImage --tag myjava . Sending build context to Docker daemon 12.88MB Step 1/5 : FROM openjdk ---> fdc7d8d04bc9 Step 2/5 : RUN PowerShell mkdir C:\fyicenter ---> Using cache ---> 017ae562fd5c Step 3/5 : COPY Hello.java C:/fyicenter/Hello.java ---> 71f4e71faecc Step 4/5 : RUN javac C:\fyicenter\Hello.java ---> Running in d975fb266549 C:\fyicenter> docker run --name myjava myjava Hello world! C:\fyicenter> docker rm myjava myjava
Ok, we are able to build our own Java Docker image with a Java program in sub-directory instead of the root directory.
For more information, see Containers on Windows Documentation.
⇒ Spaces in Path Name on Windows Images
⇐ Build My Java Image with "openjdk"
2021-11-30, 1185🔥, 0💬
Popular Posts:
What Azure AD App Registration Manifest? Azure AD App Registration Manifest is JSON file that contai...
How to use "xml-to-json" Azure API Policy Statement? The "xml-to-json" Policy Statement allows you t...
How to decode the id_token value received from Google OpenID Connect authentication response? Accord...
What is Azure API Management Publisher Dashboard? Azure API Management Publisher Dashboard is an Azu...
What's Wrong with "while ($c=fgetc($f)) {}" in PHP? If you are using "while ($c=fgetc($f)) {}" to lo...