0

Here Is my Problem: I Have a Data Science Virtual Machine for Linux (Ubuntu) which going to host my Docker Container. Inside of this container I have a Python script running. I want my C# Client in Azure Cloud integrate with this container. When it request via XMLRPC to call a function of this script via ubuntu ip, my host machine should redirect the ip address to the ip:port/ of the container. Idk how to do this ip redirecting (or maybe is called forwarding/routing?). The easiest solution I found in the internet was XMLRPC. Is anyone able to help me with this also is there any better way instead of XMLRPC or JSONRPC?

this is my client part:

[XmlRpcUrl("http://@UbuntuIP:666/ContainerIP:8000/RPC2")] 
 public interface ICallServer:IXmlRpcProxy
{
    [XmlRpcMethod]
    string result(string storageAccountName, string containerName,string imageName);
}

ICallServer icallServerTest = XmlRpcProxyGen.Create<ICallServer>();
var output = icallServerTest.func(params);
Mike Wise
  • 22,131
  • 8
  • 81
  • 104
sss
  • 81
  • 1
  • 2
  • 11

1 Answers1

1

So if I get this right, you have a C# code running in Azure cloud which is having access to your VM IP.

I am assuming that your Azure machine is able to reach the IP of your VM. Now when you launch your Python container in the VM, the python server would be listening on some port. Let's assume this port to be 8000. What you need to is that, you need to launch the docker container and publish this port on to the host

docker run -d --name my-python-container -p 8000:8000 my-python-image

Now you have a service which is accessible on your <UbuntuIP>:8000 so you can use that directly in your C# code.

Tarun Lalwani
  • 142,312
  • 9
  • 204
  • 265
  • Thanks for the Answer. But is it possible to explain what u mean by **name**? I built a docker file and name of the image is **img-processing**. I have a **Main.py** which listens to port :8000 I want to run this Mian.py in background inside of a container. Main.py is not attached to the dockerfile. I already built the Dockerfile. So now that I want to run it and create the container I have to execute your command right? But what u mean by **name**, **python-container**. I believe the my-python-image will be img-processing. – sss Jul 27 '17 at 08:47
  • name is optional, i just gave it as it gets easier to later track that container in docker ps. Also you should add the main.py inside the Dockerfile – Tarun Lalwani Jul 27 '17 at 09:14
  • Thanks I will try that. but the my-python-container is the container id? but is not created yet after running it will. – sss Jul 27 '17 at 09:34