Docker Community Forums

Share and learn in the Docker community.

Sys call open remapped to epoll/pipe/socket/connect?


(Vschiavoni) #1

this is my first post to the Docker forum.
I have a piece of code that when runs on the host machine it opens /dev/mydev and performs some operations.
When executing the exact same code inside a container, several other operations occur.
In particular, here I report (part of) the strace log under the host:

fstat(4, {st_dev=makedev(259, 1), st_ino=14424160, st_mode=S_IFREG|0644, st_nlink=1, st_uid=1002, st_gid=1002, st_blksize=4096, st_blocks=1512, st_size=770704, st_atime=2016/06/13-18:57:07.993408706, st_mtime=2016/06/13-18:46:38.281942491, st_ctime=2016/06/13-18:46:38.281942491}) = 0 mmap(NULL, 770704, PROT_READ|PROT_WRITE, MAP_PRIVATE, 4, 0) = 0x7f9ec930e000 open("/dev/mydevice", O_RDWR)

And this is the exact same part inside the container, which fails as it tries to do something else.
Note that I launch the container with full access to the host devices and in privileged mode:

$docker run --rm --privileged --cap-add=ALL -ti -v /var/run:/var/run -v /dev:/dev test /bin/bash .. fstat(4, {st_dev=makedev(0, 43), st_ino=965, st_mode=S_IFREG|0644, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=1512, st_size=770704, st_atime=2016/06/10-16:59:18, st_mtime=2016/06/10-16:59:18, st_ctime=2016/06/13-19:20:31.522323380}) = 0 mmap(NULL, 770704, PROT_READ|PROT_WRITE, MAP_PRIVATE, 4, 0) = 0x7f0b1e145000 epoll_create(1) = 5 pipe([6, 7]) = 0 epoll_ctl(5, EPOLL_CTL_ADD, 6, {EPOLLIN|EPOLLET, {u32=6, u64=2138311629375275014}}) = 0 socket(PF_LOCAL, SOCK_STREAM, 0) = 8 connect(8, {sa_family=AF_LOCAL, sun_path=@"mydevice_socket_base"}, 110) = -1 ECONNREFUSED (Connection refused) epoll_ctl(5, EPOLL_CTL_ADD, 8, {EPOLLET, {u32=8, u64=2138311629375275016}}) = 0 close(5) = 0 close(6) = 0 close(7) = 0 close(5) = -1 EBADF (Bad file descriptor) close(6) = -1 EBADF (Bad file descriptor) close(7) = -1 EBADF (Bad file descriptor) close(8) = 0 munmap(0x7f0b1e145000, 770704) = 0

Should I open a github issue ?
Docker version 1.11.2, build b9f10c9