docker stuff from some time using it

After using docker for some time one of the things I often did was some bootstraping on container start.
Currently most flexible way I got is to load a volume(because then it’s editable from outside) like

                docker run -v `pwd`/dir:/root/dir

then in bash rc invoke script that in in that mounted folder.

            source pathtoscript

also that script can take long time to run so use bash shell mutexes to prevent it to run twice
if we exec into started container

                docker exec -it container bash

to use mutexes in bash see bash mutexes.
then you might want often to change docker file or to reconfigure
so also best to leave those things at the end of dockerfile to avoid long rebuilds
Hope to get this gets you up to speed with docker.

Leave a Comment