简体   繁体   中英

How to build windows server core on Windows 10 Pro?

I have the following basic Dockerfile:

FROM mcr.microsoft.com/windows/servercore:1903
CMD echo Hello World!

When I run the command:

docker build -t latest . or docker build .

My terminal hangs forever and it seems like nothing is being done.

However, if I run:

docker pull mcr.microsoft.com/windows/servercore:1903

I can pull the image from the repository.

I'm not sure what I'm doing wrong, or how to fix it. The build command doesn't seem to have a verbose option, and I need a docker container running Windows.

I'm using Docker in Windows 10 Pro and its configured to use Windows containers.

Check which directory do you execute your commands from. You shall be executing them from directory where DOCKERFILE is located and nothing else. If you execute say from root of C drive or any other location with big number of files then docker as a first step will try to zip all of them up and then send to a builder and hence delays.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM