Closed vladostp closed 6 years ago
The short answer is you can't share unix socket between host and container.
The 9pfs doesn't support socket sharing. And exposing docker.sock
to containers breaks the isolation, which is one of the most important design goals of kata containers. We don't encourage kata containers users to employ such a use pattern.
I persoanally agree on the socket sharing is useful in some cases, and I discussed it with @egernst half a months ago. One thing we might do is create a socket proxy channel between host and containers for this case. However, there has not been any engineering effort on this feature.
Thanks a lot for your answer!
This should also be added to the https://github.com/kata-containers/runtime#limitations doc. I can certainly see that connecting to docker.sock is a bad idea for isolation.
I am having a similar issue with connecting socks between containers (in particular mysqld.sock
for https://github.com/mailcow/mailcow-dockerized) which I presume is also unable to connect due to the underlying limitation of the 9pfs bind mount. A workaround for inter-container communication could be quite useful.
Description of problem
I am not able to use shared docker socket between host machine and a docker container.
Expected result
The docker client that is in container connects to docker daemon at host machine and launches other containers.
Actual result
In the container when trying to execute any docker command "Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?"
Meta details
Running
kata-collect-data.sh
version0.0.1 (commit f6544a3524f43dbfba3ca1a3a89502e7792390b0)
at2018-07-03.10:03:03.555301752+0200
.Runtime is
/usr/local/bin/kata-runtime
.kata-env
Output of "
/usr/local/bin/kata-runtime kata-env
":Runtime config files
Runtime default config files
Runtime config file contents
Config file
/etc/kata-containers/configuration.toml
not found Output of "cat "/usr/share/defaults/kata-containers/configuration.toml"
":Image details
Initrd details
No initrd
Logfiles
Runtime logs
Recent runtime problems found in system journal:
Proxy logs
Recent proxy problems found in system journal:
Shim logs
No recent shim problems found in system journal.
Container manager details
Have
docker
Docker
Output of "
docker version
":Output of "
docker info
":Output of "
systemctl show docker
":No
kubectl
Packages
Have
dpkg
Output of "dpkg -l|egrep "(cc-oci-runtimecc-runtimerunv|kata-proxy|kata-runtime|kata-shim|kata-containers-image|linux-container|qemu-)"
":No
rpm