How to .bashrc for root in Docker

Turns out I was adding the file incorrectly. It should be /root/.bashrc rather than just .bashrc. With the file added in the correct place, no run command or CMD is required.

Build

...
ADD iptables /iptables
RUN touch /root/.bashrc \
 && cat iptables >> /root/.bashrc
...

Run

docker run -it --cap-add=NET_ADMIN myImage /bin/bash

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)