Reputation: 1394
I am currently using Docker Desktop for Mac.
My requirement is to spin off a container from another container.
Situation:
Container A has a service running which upon request looks for a swarm manager and spin off another container B. I have started single node swarm manager on my machine. I can not use host network_mode because docker for MAC exposes light weight linux vm as host and not my actual localhost. I have tried this also : https://forums.docker.com/t/access-host-not-vm-from-inside-container/11747/7
Any possible solution?
Upvotes: 2
Views: 866
Reputation: 25230
The idea is that your container can access your host. So, use the Engine API provided by Docker:
POST /containers/create
You will have to post json that contains the details of the new container.
Engine API v1.24
The daemon listens on
unix:///var/run/docker.sock
but you can Bind Docker to another host/port or a Unix socket.You can listen on port 2375 on all network interfaces with
-H tcp://0.0.0.0:2375
, or on a particular network interface using its IP address:-H tcp://192.168.59.103:2375
. It is conventional to use port 2375 for un-encrypted, and port 2376 for encrypted communication with the daemon.
Upvotes: 1