WASdev / ci.docker.websphere-traditional

Dockerfiles for WebSphere Application Server traditional
Apache License 2.0
170 stars 190 forks source link

Websphere container stops when using stopServer.sh #300

Closed fadel09 closed 8 months ago

fadel09 commented 8 months ago

Docker container automatically stops if I stop the server using the stopServer.sh script. What is recommended practice to restart the server?I need to apply a new configuration and docker restart image_id remove the new configuration

BradleyMayo commented 8 months ago

Hello, generally speaking you should not make runtime changes to the configuration of a docker image. Any configuration should be done when the container is built by adding the configuration scripts to the /work/config folder as seen here https://github.com/WASdev/ci.docker.websphere-traditional#adding-an-application-and-advanced-configuration-during-build-phase.

If the configuration you are applying requires the server to be started and stopped, you can call those commands in your configuration scripts and they will run when your image is building without you needing to manually adjust the image after it is already built.

The reason your docker container stops when the stopServer.sh command is run is because the container is bound to the running server via the line CMD ["env", "JVM_EXTRA_CMD_ARGS=-Xnoloa", "/work/start_server.sh"] in the Dockerfiles we use to build the published images. You can override the CMD and bind the container to a different process by setting your own CMD instruction in the Dockerfile you are using for your application. You can also override the CMD instruction when you launch your container image via the parameters passed to docker. You can read more about overriding here https://docs.docker.com/engine/reference/run/#overriding-dockerfile-image-defaults

Overriding the CMD instruction may lead to abnormal behavior for your container as it could end up as a running image without the server actually running on it. Again, the best practice is to apply all configuration when you build your image through scripts.

fadel09 commented 8 months ago

Thanks alot it worked.