Dockerfile: create and mount disk image during build

Viewed 3718

I am trying to build and mount a custom disk image during the Dockerfile build process:

FROM ubuntu:16.04
RUN dd if=/dev/zero of=foo.img count=500 bs=1M
RUN mkfs.ext4 foo.img
RUN mkdir -p /media/ext4disk
RUN mount -t ext4 foo.img /media/ext4disk

Running docker build, I get the following error message on the last command: mount failed: Unknown error -1.

Is there any way to achieve what I want to do?

2 Answers
Related