I have base image with Jboss copied on it. Jboss is started with a script and takes around 2 minutes.
In my Dockerfile
I have created a command.
CMD start_deploy.sh && tail -F server.log
I do a tail to keep the container alive otherwise " docker-compose up
" exits when script finishes and container stops.
The problem is when I do " docker-compose up
" through Jenkins the build doesn't finishes because of tail and I couldn't start the next build.
If I do " docker-compose up -d
" then next build starts too early and starts executing tests against the container which hasn't started yet.
Is there a way to return from docker-compose up when server has started completely.
Whenever you have chained commands or piped commands ( |
), it is easier to:
easier wrap them in a script, and use that script in your CMD
directive:
CMD myscript
or wrap them in an sh -c
command:
sh -c 'start_deploy.sh && tail -F server.log'
(but that last one depends on the ENTRYPOINT
of the image.
A default ENTRYPOINT
should allow this CMD
to work)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.