SergiiKozlov
SergiiKozlov

Reputation: 831

Docker Is there a possibility to restart CMD instruction?

I have a very simple scenario.

I have some Dockerfile where CMD instruction starts up JETTY. After some tests performed I need to restart JETTY due to the change in my test data.

And I cannot restart JETTY process due to the docker is single process application. What will be the proper solution for that?

Thanks Regards, Sergii

Upvotes: 3

Views: 3642

Answers (1)

Andy
Andy

Reputation: 38287

There are several ways you could proceed, depending on how often you'll need to restart Jetty.

  1. use docker restart on the container. This will re-run the command or entrypoint, and it can be automated. Or ...
  2. use docker exec -it /bin/bash to enter the container and manually restart JETTY. Useful for when you want to interact with it more and debug, but not a good practice for production. or
  3. Configure a supervisor or similar within the container to monitor for when content changes and automatically restart Jetty. This is a pretty common practice even though it breaks the "one process" idea. Alternatively you could add this kind of monitor on the outside of the container (on the host) and use it to automate 1) above.

Upvotes: 1

Related Questions