.netcore/docker实践, It was not possible to find any installed .NET Core SDKs

We can run the .net core look out of the results page, and now we need .net core of the case is ready, and we are now deployed in the docker.
We open PowerShell, enter docker info following interface appears like proof docker everything is normal.

We enter into the root directory we just created .net core project, and then start building docker mirror, pay attention to the back of the command., Meaning the current directory

docker build -t demotest .

Then we found that in the implementation of the sixth step of the error, saying can not find the file in the path

I also stuck in here cards for a long time, finally found the right path spliced together. The sixth step closer inspection we found that the file path under Dockerfile file is dockertest / dockertest.csproj, combined with our current path is E: \ Docker \ dockertest
\ dockertest, a combination point of view, more than a dockertest, then we modify Dockerfile file in this multi-path is removed dockertest /

Then let us perform docker build -t demotest. Then we found at step 10 when they went wrong, saying that this program does not contain static entry point for the 'Main' method, we continue to check the next Dockerfile file and found that step 9 working path
is / src / dockertest, we splice it found that the addition of a / dockertest, then we continue to get rid of this, and then continue to run docker build -t demotest.

This time finally live up to expectations. It runs the full completion of all the steps and tips

Successfully built eaa8cea8fcf4
Successfully tagged demotest:latest

我们来看看构建镜像是否真的成功了吧

docker images

我们发现了这一个,是我们刚刚创建的demotest,既然镜像我们已经创建成功了,那我们正式运行起来看看是否可用。

docker run --name=demotest -p 7778:80 -d demotest
--name:指定容器名称
-p:指定容器端口
-d:指定容器 后台运行

然后出现了一串字符串,说明我们启动成功了,然后我们查看一下我们正在运行的容器

docker ps

 

用docker ps -a看看已经挂掉的容器,然后docker logs <container>看下容器的日志。

 

 

然后我们去浏览器输入ip+7778,看到如下页面证明这次docker for windows  +.net core 成功运行了。

 

那么到这里我们的第一的windows+docker运行.netcore算是正式完工了,然后在给大家介绍一些较为常用的docker命令(命令)

docker build -t demotest .    构建 demotest镜像
docker images                      查看当前所有的镜像
docker inspect demotest     查看 运行容器的详情
docker ps                         查看当前运行的容器
docker ps -a                      查看当前所有的容器
docker stop demotest      停止运行demotest容器
docker start demotest     开启运行demotest容器
docker rm demotest     删除demotest容器
docker rmi demotest    删除demotest镜像
docker rm $(docker ps -aq)     删除所有容器
docker rmi $(docker images -q)   删除所有镜像

 

Guess you like

Origin www.cnblogs.com/start2019/p/12334237.html