Open gkulkarni2020 opened 4 years ago
have you checked out RunImageConfiguration
in docs? Here is an example:
I have been using Dockerfile for my project with a sample code like given below.
RUN groupadd syslog && apt-get update && apt-get -q install -y curl logrotate iproute2
Actually, everything in the Dockerfile is running during build time in order to prepare the container image. So I don't really understand your use case here. In your example logrotate
is installed during docker build
, not docker run
(everything within a Dockerfile is executed during build time).
Said that you can provide an entrypoint or command in the run configuration which is executed when a container is started (otherwise the default from the image is used). Use entrypoint
or cmd
as described in https://dmp.fabric8.io/#start-configuration for executing code during startup (but this code must obviously already be contained within the container image).
I have been using Dockerfile for my project with a sample code like given below.
RUN groupadd syslog && apt-get update && apt-get -q install -y curl logrotate iproute2
I would like to convert this to pom.xml so that other micro-services can inherit it.
I surely cannot add this under build tag as I cannot and don't want this to get executed at the build time, I rather want this to set up logrotate in the container when the container starts up.
I tried adding few run commands, but that did not work. I am trying to understand which XML tag needs to be used for making sure my container RUNs the command on start up?