I need your help to know if I’m understanding correctly the way docker publishing works.
I created a custom Image with Dockerfile. The Dockerfile is as follows:
FROM mcr.microsoft.com/dotnet/framework/wcf:4.8 COPY ./ . RUN "C:\assets\vc_redist.x64.exe" /quiet /install WORKDIR /ServicioOcr . RUN powershell -NoProfile -Command \ Import-module IISAdministration; \ New-IISSite -Name "ServicioOcr" -PhysicalPath C:\ServicioOcr -BindingInformation "*:1990:"; \ Add-WindowsFeature NET-WCF-HTTP-Activation45 ENTRYPOINT ["C:\\KeepAlive.exe"] EXPOSE 1990
Then I run a container publishing the exposed ports without problems:
docker -d -p 2019:1990 --name servicecontainer serviceimage:v8 d96e49d67157 serviceimage:v1 "C:\\ServiceMonitor.eÔÇª" 3 hours ago Up 2 hours 80/tcp, 808/tcp, 0.0.0.0:2019->1990/tcp servicecontainer
Once I , I created a Docker Service, so I could have multiple replicas of the containers that host the service, using the following command:
docker service create --name=SWARM_SERVICE --endpoint-mode dnsrr --network=SWARM_NETWORK serviceimage:v8 --publish 2019:2020 shkmfrrodg1a SWARM_SERVICE.1 serviceimage:v1 BAZ1573221 Running Running 2 hours ago
As I understand, the way Docker Service should work is the following:
- Docker Service creates number of specified replicas inside it. Each replica running a separated instance of the service.
- Service inside the containers should be available through published ip:port.
- Requests are made to the published ip:port, and then being forwarded to an available replica/container that can handle it.
Is my understanding right?
Thanks in advance.