Cory Nezin
Cory Nezin

Reputation: 1581

Docker error after copying a file called `run`

My Dockerfile is this:

FROM artprod.dev.bloomberg.com/auto/ubuntu:16.04

COPY run .

Building works okay, but then when I run it, I get this error that goes something like this:

container_linux.go:247: starting container process caused "process_linux.go:364: container init caused \"rootfs_linux.go:54: mounting

If I don't copy the run file or rename it to something else, it works fine. Why is this happening?

Upvotes: 0

Views: 142

Answers (2)

Adiii
Adiii

Reputation: 59906

You are overiding run directory of the container, renamed it to something else then it should work like copy my_run .

Apparently, many tools (among them udev) will soon require a /run/ directory that is mounted early (as tmpfs). Arch developers introduced /run last month to prepare for this.

The udev runtime data moved from /dev/.udev/ to /run/udev/. The /run mountpoint is supposed to be a tmpfs mounted during early boot, available and writable to for all tools at any time during bootup, it replaces /var/run/, which should become a symlink someday.

what-is-this-new-run-filesystem

ubuntu Container expect these files in the run directory in case of ubuntu

initctl  lock  log  mount  sendsigs.omit.d  shm  systemd  user  utmp

Perhaps it is a bad idea to copy files into the root of the image.

The idea may be bad but the actual reason is above.

in container common way to copy the file to /app

copy run /app

Upvotes: 1

Cory Nezin
Cory Nezin

Reputation: 1581

Inside the image root directory, there is a folder called run which contains a file which is mounted by Docker. Running the COPY command overwrites the directory, unlike the cp bash command, resulting in destruction of the file, causing the error. Perhaps it is a bad idea to copy files into the root of the image.

Upvotes: 1

Related Questions