Hi,
I just got started playing with Docker and I was wondering what was the best way to get a custom bashrc file loaded every time in a container. Either in every container or per container.
Thanks!
If #1757 gets merged you'll be able to do something like docker run -i -t -v ~/.bashrc:~/.bashrc ubuntu bash
. Until then, just make sure ~/.bashrc exists when the container is started:
$ docker run -d ubuntu bash -c "echo 'export foo=bar' > .bashrc"
29b2ebb155e3
$ docker commit 29b2ebb155e3 mybase
e39a1d44ad80
$ docker run -i -t mybase bash
root@2ad5a06af680:/# echo $foo
bar
root@2ad5a06af680:/#
Giving that .bashrc is in the image, you can also use /bin/bash -l
Thanks a lot. I was confused that the loaded .bashrc
was /.bashrc
and not /root/.bashrc
.
Most helpful comment
Giving that .bashrc is in the image, you can also use
/bin/bash -l