1

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.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250

1 Answers1

0

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)

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250