Alex Ushakov
Alex Ushakov

Reputation: 2519

Docker: how control docker service on host from it's container?

There is possibility to install docker in docker container.

How to control docker host service from it's container (manage another containers)?

If execute docker run --privileged=true -v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):$(which docker) -ti debian and enter docker error appears: docker: error while loading shared libraries: libapparmor.so.1: cannot open shared object file: No such file

Upvotes: 0

Views: 1129

Answers (2)

mohamnag
mohamnag

Reputation: 2883

if your host is a linux based machine, you dont need to install docker inside container, you can just mount docker into container and whatever you do with that inside your container is just like doing it on host. I have tested it on a Ubuntu machine (image: https://github.com/mohamnag/ubuntu-git.git) by mounting /usr/bin/docker from host into /bin/docker inside container. then inside that container you can literally do (build, stop, list ...) whatever you may have done with docker inside host.

Upvotes: 0

larsks
larsks

Reputation: 312490

The error you're seeing seems very clear: the docker binary requires a shared library that is not present inside the container.

Is your container running the same distribution and version as your host? If it is, you simply need to determine which packages provide the necessary dependencies and install them inside the container.

If not, you will probably have better luck simply installing docker inside the container, rather than trying to bind-mount it from the host. There is probably a source of recent Docker versions available for Debian.

Upvotes: 2

Related Questions