Docker exec runs command on host machine instead of container

3.5k views Asked by At

I have docker (Docker version 1.3.1, build 4e9bbfa) running on virtual machine. I have created some containers that has supervisor running to allow sshd and apache running.

Right now in order to do some changed i have to log in to ssh and run sh script, I tried exec command, but it seems not working on that server.

What i did to examine a problem: created file named host.txt in root (/) folder of host (where docker daemon is running) and executed

docker exec {container name} ls /

and it gave me list where host.txt present (Not that I have not mounted / into containers / (i even dont know if its possible))

I made exact same container on exact same docker version and executed same test on my ubuntu 14.04 machine, and it works as expected (no host.txt in list)

Any ideas why this might be happening?

1

There are 1 answers

1
Pavel Galaton On BEST ANSWER

I found what caused the issue kernel < 3.8 is not supported

https://github.com/docker/docker/issues/8976

So for example on following machine it will not work:

uname -a
Linux VIR005-M033-APP 3.2.0-4-amd64 #1 SMP Debian 3.2.51-1 x86_64 GNU/Linux