[英]Dotnet application build using Docker-compose
I am looking for some help in build a robust docker-compose file. 我在构建健壮的docker-compose文件时寻求帮助。 I have my docker images in my private repository, Before i used to pull all images and then used to try docker run commands individually to build a container.
我将docker映像保存在私有存储库中,在此之前,我先提取所有映像,然后再尝试分别运行docker run命令来构建容器。 Now i am planning to build a docker-compose file.
现在我正计划构建一个docker-compose文件。
Manual commands used: 使用的手动命令:
docker run --restart unless-stopped -t -d --name test_rest -p 9095:80 --entrypoint dotnet test_rest script_var.Core.dll test_var:MongoSource=mongodb://192.168.22.22 KafkaReceiveStream:KafkaBroker=192.168.22.22:9092 KafkaReceiveStream:KafkaTopic=testevents KafkaSendStream:KafkaTopic=test_key KafkaSendStream:KafkaBroker=192.168.22.22:9092
docker run --restart unless-stopped -t -d --name test_app1 -p 9096:80 --entrypoint dotnet test_app1 script_var.Core.dll test_var:MongoSource=mongodb://192.168.22.22
docker run --restart unless-stopped -t -d --name test_app2 --entrypoint dotnet test_app2 script_var.Core.dll
Now I would like to build a docker-compose file out from above commands. 现在,我想从上述命令中构建一个docker-compose文件。
version: '2.1'
networks:
mynetwork:
driver: bridge
services:
test_reste:
image: test_rest
ports:
- "9095:80"
networks:
- mynetwork
test_app1:
image: test_app1
ports:
- "9096:80"
networks:
- mynetwork
test_app2:
image: test_app2
networks:
- mynetwork
How can we add the entry point in docker-compose file, i tried to add 我们如何在docker-compose文件中添加入口点,我尝试添加
image: test_rest
entrypoint:
- dotnet
- test_rest
- script_var.Core.dll
.
.
.
This is the error i got: 这是我得到的错误:
Did you mean to run dotnet SDK commands? Please install dotnet SDK from:
test_rest_1 | http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
Can some one help me how can we solve this issue? 可以帮我解决这个问题吗?
Thanks in advance. 提前致谢。
Not sure if you ended up figuring this out but the place to put your ENTRYPOINT
is in the Dockerfile
, not the docker-compose
file. 不知道您是否最终弄清楚了这个问题,但将
ENTRYPOINT
放置在Dockerfile
,而不是Dockerfile
docker-compose
文件中。
So your Dockerfile
might look something like this: 因此,您的
Dockerfile
可能看起来像这样:
FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 9095
EXPOSE 9096
FROM pathToYourImage AS build
WORKDIR /src
# ... you should already have a Dockerfile for your private repos images? ...
ENTRYPOINT ["dotnet", "test_rest.dll"]
EDIT 1: My apologies, you can add entrypoint to your compose. 编辑1:对不起,您可以将入口点添加到您的撰写。 For example:
例如:
entrypoint: ["dotnet", "test_rest.dll"]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.