-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Implement s2i support #32
Conversation
I see some warnings when running the fix-permissions script on the s2i config files. ---> Installing application source ... |
@hhorak Please take a look at updated |
@TomasTomecek suggested we should document extending images in the Dockerfile, so one can e.g. change USER to 0 to be able to install RPMs.. |
I am not sure what is meant here by 'extending images in the Dockerfile' and how it is connected to s2i. |
it means create a docker strategy build in openshift that has a dockerfile which starts FROM this image, sets USER root, yum installs whatever you need, then sets USER xxxx (whatever the default user for the image was originally). That will produce a customized version of this image, w/ the additional packages. You can then use that image as your s2i builder image, which can you use in a normal s2i strategy build. |
I think something like this should be enough:
|
@omron93 thanks, |
@TomasTomecek There is now an example |
rpm -V $INSTALL_PKGS && \ | ||
yum clean all | ||
USER 27 | ||
COPY test-app /opt/app-root/src |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this really necessary? (having this file/"test"?) it's docker image 101 (mentioning how to do this in the readme seems reasonable, providing a dockerfile to do it seems unnecessary, having a test that builds the dockerfile seems beyond unnecessary)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely not necessary. Although it happened to us recently that one image that was built on top of ours got broken because we changed something we believed was an implementation detail.. so yeah, it's hard to find the line..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm definitely with Honza here: having test for this ensures it's working and supported. It's also a very nice example.
This PR has been re-worked from scratch and continues in #45. |
This is very similar to the MongoDB PoC: sclorg/mongodb-container#239
It adds extending support using source-to-image.
For example to build customized MariaDB database image
my-mariadb-centos7
with configuration in~/image-configuration/
run:The directory passed to
s2i build
can contain these directories:mysql-cfg/
mysqld
daemonenvsubst
command is run on this file to still allow customization of the image using environmental variablesmysql-pre-init/
*.sh
) available in this directory are sourced beforemysqld
daemon is startedmysql-init/
*.sh
) available in this directory are sourced whenmysqld
daemon is started locally${mysql_flags}
to connect to the locally running daemon, for examplemysql $mysql_flags < dump.sql
Variables that can be used in the scripts provided to s2i:
$mysql_flags
-- arguments for themysql
tool that will connect to the locally runningmysqld
during initialization$MYSQL_RUNNING_AS_MASTER
-- variable defined when the container is run withrun-mysqld-master
command$MYSQL_RUNNING_AS_SLAVE
-- variable defined when the container is run withrun-mysqld-slave
command$MYSQL_DATADIR_FIRST_INIT
-- variable defined when the container was initialized from the empty data dirDuring
s2i build
all provided files are copied into/opt/app-root/src
directory into the resulting image. If some configuration files are present in the destination directory, files with the same name are overwritten. Also only one file with the same name can be used for customization and user provided files are preferred over default files in/usr/share/container-scripts/mysql/
- so it is possible to overwrite them.Same configuration directory structure can be used to customize the image every time the image is started using
docker run
. The directory has to be mounted into/opt/app-root/src/
in the image (-v ./image-configuration/:/opt/app-root/src/
). This overwrites customization built into the image.