我在.NET Core中有ASP.NET MVC应用程序。我使用docker-compose.yml和命令在Docker中运行它:
docker-compose up –d
现在,我可以在http://localhost:5000上显示我的网站。 但是,如果我在类或cshtml文件中进行了更改,则在http://localhost:5000上看不到这些更改。我该怎么办?停止容器,下一步呢?还是其他?
答案 0 :(得分:0)
您应该重建容器
docker-compose up –d --build
您可以像这样在docker-compose中重建特定容器
docker-compose up –d --build service_name_1 service_name_2
来自此来源https://docs.docker.com/compose/reference/build/
docker-compose build
Estimated reading time: 1 minute
Usage: build [options] [--build-arg key=val...] [SERVICE...]
Options:
--compress Compress the build context using gzip.
--force-rm Always remove intermediate containers.
--no-cache Do not use cache when building the image.
--pull Always attempt to pull a newer version of the image.
-m, --memory MEM Sets memory limit for the build container.
--build-arg key=val Set build-time variables for services.
--parallel Build images in parallel.
Services are built once and then tagged, by default as project_service. For example, composetest_db. If the Compose file specifies an image name, the image is tagged with that name, substituting any variables beforehand. See variable substitution.
If you change a service’s Dockerfile or the contents of its build directory, run docker-compose build to rebuild it.