I'm using a Dockerfile
to build my image and I have a command in there that says:
RUN sysctl -w net.ipv4.route.flush=1
but it fails to build the image with the following error:
Step 20 : RUN sysctl -w net.ipv4.route.flush=1
---> Running in 4d7302b56c53
sysctl: setting key "net.ipv4.route.flush": Read-only file system
For security reasons, you need to be in privileged mode for this operation. It is not currently possible to use a Dockerfile with the privileged mode.
$> docker run ubuntu sysctl -w net.ipv4.route.flush=1 && echo ok || echo ko
sysctl: setting key "net.ipv4.route.flush": Read-only file system
ko
$> docker run --privileged ubuntu sysctl -w net.ipv4.route.flush=1 && echo ok || echo ko
ok
Why do you need to do this at build time?
This may not apply to your exact situation, but I was receiving read-only file system
notices frequently when trying to do a number of operations involving writes:
docker build
docker rmi
In my case, I was able to solve just by stopping and starting boot2docker
:
$ bootdocker down
$ bootdocker up
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With