我正在尝试使用docker在树莓派上运行asp.net核心应用程序,我想我的主要部分不在其中。我在github上有一个存储库,它是一个简单的asp.net核心项目。我已经在docker cloud上设置了一个帐户,该帐户在每次推送到github存储库时都会建立。
我运行命令:docker run -d -p 8080:80 joro550/radiusnet --network=host
并且可以看到它正在运行:
但是,当我在端口8080上转到pi的ip地址时,会得到以下信息:
当我一直在寻找这些人时,建议添加这些标志(我尝试过并得出相同的结果:
I think at this point I'm at a bit of a lose as to how to access this thing. The docker documentation does suggest running
`docker inspect -f "{{ .NetworkSettings.Networks.nat.IPAddress }}" myapp`
If I'm using windows 10 Nano containers, which I don't believe I'm using but when I run this command I get a resounding <no value>
Cutting it back to docker inspect -f "{{ .NetworkSettings.IPAddress }}" myapp
gives me a different ip address to my ips internal ip address, which I've tried on port 8080 and get the same result
Doing a curl on both addresses gives me the same result of connection refused:
Here's my docker file for anyone interested:
FROM microsoft/aspnetcore-build:2.0 AS build-env
WORKDIR /app
# copy csproj and restore as distinct layers
COPY /src ./
RUN dotnet restore
# copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out -r linux-arm
# build runtime image
FROM microsoft/dotnet:2.0.0-runtime-stretch-arm32v7
WORKDIR /app
COPY --from=build-env /app/src/RadiusNet.Web/out .
EXPOSE 80
ENTRYPOINT ["dotnet", "RadiusNet.Web.dll"]
If any more information is needed please ask, I'm pretty new to Docker so I just did a bit of a knowledge dump of my current situation.
链接到github项目(如果需要):https : //github.com/joro550/RadiusNet
任何帮助-在这一点上将不胜感激
首先有几点评论
侦听端口由“ docker端口”报告,但不保证将为它们提供服务。
# docker run --name radiusnet -p 8001-8009:5000/tcp radiusnet
Hosting environment: Production
Content root path: /app
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
# docker port radiusnet
5000/tcp -> 0.0.0.0:8001
布丁的证明...
# wget -O /tmp/test.html http://localhost:8001/
--2018-02-08 16:22:46-- http://localhost:8001/
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:8001... connected.
HTTP request sent, awaiting response...
如果失败,则发布了错误的端口。
当以“-网络主机”启动时,“ docker端口”可能不报告任何内容,而docker服务良好。“ lsof”可以提供帮助。
# docker run --name radiusnet --network host radiusnet
Hosting environment: Production
Content root path: /app
Now listening on: http://localhost:5000
# docker port radiusnet
# ps -ef | grep dotnet
root 540 27973 0 16:46 pts/2 00:00:00 grep dotnet
root 32452 32437 7 16:37 ? 00:00:43 dotnet RadiusNet.Web.dll
# lsof -Pn -p 32452 | grep LISTEN
dotnet 32452 root 368u IPv4 106845 0t0 TCP 127.0.0.1:5000 (LISTEN)
dotnet 32452 root 383u IPv6 106854 0t0 TCP [::1]:5000 (LISTEN)
# wget -O /tmp/test.html http://localhost:5000/
--2018-02-08 16:56:27-- http://localhost:5000/
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:5000... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘/tmp/test.html’
一切都很好,就一切都好。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句