Is it possible to perform Docker-call from a conta

2019-08-28 19:22发布

问题:

I would like to be able to, e.g., restart host containers from inside a container.

Does anyone know whether there is any way I could do that?

回答1:

Assuming that your question is "Is it possible to perform Docker-call from a container into the host?"

Yeah, sure it is possible! The communication with the Docker daemon goes through a socket. By default this socket is the unix:///var/run/docker.sock. Your manager-container just need access (and permission) to this socket.

Note that an option of the Docker daemon (I'm looking at ou -H, --host) allows the communication through TCP (or even a fd).

You then just need a Docker client (any Docker API implementation) to communicate.



标签: docker