Search code examples
bashdockerubuntuarm

Issue: Error while running ubuntu bash shell in docker


I am running docker on my arm based 32 bit device.

However, when i try to run an ubuntu bash shell as a docker container via the command : docker run -it ubuntu bash , I keep getting the following error:

docker: Error response from daemon: OCI runtime create failed: 
container_linux.go:348: starting container process caused 
"process_linux.go:402: container init caused \"open /dev/ptmx: no such file or directory\"": unknown.

Here's what docker info gives:

Containers: 4
Running: 0
Paused: 0
Stopped: 4
Images: 3
Server Version: 18.06.1-ce
Storage Driver: vfs
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 468a545b9edcd5932818eb9de8e72413e616e86e
runc version: 69663f0bd4b60df09991c08812a60108003fa340
init version: fec3683
Security Options:
 seccomp
  Profile: default
Kernel Version: 3.10.65-00273-gfa38327-dirty
OSType: linux
Architecture: armv7l
CPUs: 4
Total Memory: 923MiB
ID: 2PDV:3KHU:VZZM:DM6F:4MVR:TXBN:35YJ:VWP5:TMHD:GMKW:TPMI:MALC
Docker Root Dir: /opt/usr/media/docker_workdir
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

It would be great if someone could tell me what's wrong and how can I fix this ?


Solution

  • It looks like your OS is missing pseudo-terminals (PTY) - a device that has the functions of a physical terminal without actually being one.

    The file /dev/ptmx is a character file with major number 5 and minor number 2, usually of mode 0666 and owner.group of root.root. It is used to create a pseudo-terminal mas­ter and slave pair.

    FILES

    • /dev/ptmx - UNIX 98 master clone device
    • /dev/pts/* - UNIX 98 slave devices
    • /dev/pty[p-za-e][0-9a-f] - BSD master devices
    • /dev/tty[p-za-e][0-9a-f] - BSD slave devices

    Reference: http://man7.org/linux/man-pages/man7/pty.7.html

    This is by default included into Linux kernel. Maybe lack of it is somehow related to your OS architecture. Also, I'm not sure how can you fix, maybe try to update && upgrade OS.

    Quick workaround if you don't need a tty would be to skip -t flag:

    docker run -i ubuntu bash

    In docker run -it, -i/--interactive means "keep stdin open" and -t/--tty means "tell the container that stdin is a pseudo tty". The key here is the word "interactive". If you omit the flag, the container still executes /bin/bash but exits immediately. With the flag, the container executes /bin/bash then patiently waits for your input. That means now you will have bash session inside the container, so you can ls, mkdir, or do any bash command inside the container.