IBM / BlueXolo

BlueXolo
Apache License 2.0
19 stars 20 forks source link

Create startup script to modify startup commands in container without rebuild docker image #373

Closed daniel-zvpl closed 4 years ago

daniel-zvpl commented 4 years ago

Many times is necessary to run some command after the BlueXolo container starts, example; test new feature that needs to run after container starts, modify BlueXolo behavior to launch some task(s) after start container, etc.

By now the unique alternative to get this, is modify the rc.local file. This file is stored in docker/scripts/rc.local. This script run when container start, and because this script is attached to BlueXolo docker image even if the rc.local is modified and stored in the volume "/opt/BlueXolo-src" the changes will be not applied, the reason is because the docker image is built with different version of rc.local

That means that if you want to add a new task on-start process is necessary to modify the rc.local, and also rebuild the docker image, making this, the new docker image will have the new version of the rc.local that the developer has just wrote in rc.local

As we can figure, this could turn into a hardly task because even modify the rc.local to add the most simple task on-start will force to the developer to rebuild a new image, and most important. The docker image that is stored in docker hub will be hardly to keep up to date.

The solution to avoid many rebuild of the image during the dev process consists in next steps:

With this changes if any other developer needs to performance some task(s) after docker container has started, the developer will needs to make changes in file user-startup-tasks.sh, then ensure that this file is stored in the directory that is used by the volume "/opt/BlueXolo-src", and finally restart the container. As we can see it won't be neccessary to rebuild bluexolo docker image every time when some task on start needs to be performed