uzyexe / dockerfile-newrelic

New Relic Dockerfile
MIT License
7 stars 13 forks source link

mount /dev removes host's ptmx #2

Open odedlaz opened 8 years ago

odedlaz commented 8 years ago

I've been having ssh'ing issues to my server after running the container. It looks like after running it, docker removes /dev/ptmx, consequently messing up the tty's, and not giving me an interactive shell.

I tried to mount /dev in read-only mode to see what's going on, and as you can see, it tries to remove /dev/ptmx:

$ docker run -d -v /var/run/docker.sock:/var/run/docker.sock:ro -e NEW_RELIC_LICENSE_KEY=<KEY> --privileged --pid="host" --net="host" --ipc="host" -v /sys:/sys -v /dev:/dev:ro --restart=always --name newrelic uzyexe/newrelic
<CONTAINER_ID>
Error response from daemon: Cannot start container <CONTAINER_ID>: [8] System error: remove /apps/docker/devicemapper/mnt/<CONTAINER_ID>/rootfs/dev/ptmx: device or resource busy

to fix that, I had to re-create ptmx:

$ rm -rf /dev/ptmx
$ mknod /dev/ptmx c 5 2
$ chmod 666 /dev/ptmx
$ umount /dev/pts
$ rm -rf /dev/pts
$ mkdir /dev/pts
$ mount -vt devpts -o gid=4,mode=620 none /dev/pts

It looks like a workaround is to create a tty for this container, but not mount /dev:

docker run -t -d -v /var/run/docker.sock:/var/run/docker.sock:ro -e NEW_RELIC_LICENSE_KEY=<KEY> --privileged --pid="host" --net="host" --ipc="host" -v /sys:/sys --restart=always --name newrelic uzyexe/newrelic

thoughts?

uzyexe commented 8 years ago

Hi, @odedlaz

Thank you for your report. Can you paste the output of docker info and docker version please?

odedlaz commented 8 years ago

no worries!

docker version

Client version: 1.7.1
Client API version: 1.19
Package Version (client): docker-1.7.1-115.el7.x86_64
Go version (client): go1.4.2
Git commit (client): 446ad9b/1.7.1
OS/Arch (client): linux/amd64
Server version: 1.7.1
Server API version: 1.19
Package Version (server): docker-1.7.1-115.el7.x86_64
Go version (server): go1.4.2
Git commit (server): 446ad9b/1.7.1
OS/Arch (server): linux/amd64

docker info

Containers: 12
Images: 163
Storage Driver: devicemapper
 Pool Name: vgdockerpool-docker--pool
 Pool Blocksize: 524.3 kB
 Backing Filesystem: xfs
 Data file: 
 Metadata file: 
 Data Space Used: 9.222 GB
 Data Space Total: 18.53 GB
 Data Space Available: 9.308 GB
 Metadata Space Used: 4.735 MB
 Metadata Space Total: 25.17 MB
 Metadata Space Available: 20.43 MB
 Udev Sync Supported: true
 Deferred Removal Enabled: false
 Library Version: 1.02.93-RHEL7 (2015-01-28)
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 3.10.0-229.14.1.el7.x86_64
Operating System: Red Hat Enterprise Linux
CPUs: 4
Total Memory: 7.634 GiB
Name: myserver
ID: myserver-id