Skip to content

mount /dev removes host's ptmx #2

@odedlaz

Description

@odedlaz

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions