Closed zhangineer2 closed 2 years ago
Hi @zhangineer, I can't understand what you're trying to achieve, could you please explain and post some examples?
Hi @Skazza94 basically I am just trying to run a simple Kathara lab, but from inside a container https://github.com/KatharaFramework/Kathara/wiki/Kathara-Python-API
I am trying to create the kathara containers on the host, while using the above example
Thank you
Since Kathará relies on Docker, you need a Docker container with Docker and Kathará installed in it. We're working on supporting this feature, but in the meanwhile you can use the following Dockerfile to build the aforementioned image. It contains both the Kathará binary and the PyPI package.
@Skazza94 I can definitely add docker to the image that I am using, however, wouldn't that spin up Kathara inside the docker container rather than on the host ?
This picture illustrates that I am trying to do.
Hi @zhangineer, now I understand your request. I edited the previous Dockerfile to work with this setup: DockerHost.zip
After building it (e.g. with hostdocker
image name), you have to mount the host Docker socket inside the container.
Through this socket, Kathará will create the containers on the host:
docker run -v /var/run/docker.sock:/var/run/docker.sock -v /var/run/docker.pid:/var/run/docker.pid -ti --privileged hostdocker /bin/bash
P.S.: I also installed both the Kathará binary and the PyPI package, and the container automatically opens in the Python3.9 venv.
Hope this is useful! Mariano.
Hello
I have a use case where I need to start kathara containers by executing commands from another container.
I would first like to know if this is indeed supported. When I run the code directly on the host, it works fine. But when I try to run it from inside a container, I get the following error
The above error was very similar to an issue described here https://github.com/docker/for-win/issues/9282. They appear to be the same error message, but different cause.
Thank you for all your help Peter