Michael Ströder
Michael Ströder

Reputation: 1318

Determine docker container of incoming request on Unix domain socket

I've implemented a small service in Python 2.7 listening on a Unix domain socket. It also retrieves the peer credentials (PID, UID, GID).

Now I'm experimenting with Docker containers and use volume sharing to make the Unix domain socket of this service running on the host visible in the container.

The component in the container sends the requests just fine. But the service should behave differently based on which container the request came from. The peer credentials (PID, UID, GID) of the incoming request are just that from inside the container.

Can I determine from which container the request was sent (without having a separate Unix domain socket for eached container spawned)?

Upvotes: 1

Views: 491

Answers (1)

NightOwl19
NightOwl19

Reputation: 428

If you are using any EXPOSE here say, EXPOSE 3971 or 3972 which makes it more specific to which container listening on that port request is send to. Apart from checking if SSL is running properly or not, you can also check whether or not you are running the same version of Requests in the container and on the outside.

Upvotes: -1

Related Questions