3

I am evaluating application sample with WebSphere8 running in Docker. https://hub.docker.com/r/ibmcom/websphere-traditional/

Along with this tech note, I want to change some server settings. http://www-01.ibm.com/support/docview.wss?uid=swg21614221

But as you know, docker container throw away any changes in container storage once the application server is restarted.

So, my question is how can I preserve these server settings change beyond server restart, such as using docker volume.

ruimo
  • 343
  • 3
  • 12
  • 1
    "docker container throw away any changes in container storage once the application server is restarted" - this is not true. If you will just stop and start already created container it preserves the changes. Only if you create new container from the image file - then you lose the changes. Use the `stop/start` commands instead of `run`. – Gas Jun 23 '18 at 09:17
  • 1
    Yes, I can even commit the changed image. But the problem is the newer base images will be released in the future. I do not want repeat settings changes every time the newer base images are released. – ruimo Jun 24 '18 at 23:29
  • I'm looking for a thorough answer myself, but this video does demonstrate the technique of using a data volume for the profile, which I think might be part of the solution: https://www.youtube.com/watch?v=OU0pELBTJk8&t=8s – dbreaux Jun 26 '18 at 16:15

2 Answers2

4

If you want to make changes via the UI (admin console), then consider using docker commit to save your modified image and then spawn containers from that new image. https://docs.docker.com/engine/reference/commandline/commit/

ArthurDM
  • 403
  • 3
  • 6
1

You want to customize the image. The simplest way is to have your own Dockerfile with FROM ibmcom/websphere-traditional:latest then RUN whatever wsadmin commands (with -conntype NONE) you need to perform customization, including your application deployment.

covener
  • 17,402
  • 2
  • 31
  • 45
  • 1
    Also, if you need to run commands that require the server to be running (i.e. can't use the NONE conntype), you can follow the same pattern as demonstrated in this Dockerfile (https://github.com/WASdev/ci.docker.websphere-traditional/blob/master/base/Dockerfile.profile#L33) to call out to a script (which you would have copied into the image using COPY) that has your commands and gets invoked after `start_script`. This pattern ensures that everything you need is contained within your image, so it can restart new containers without any issues (auto-scaling, recovering, etc) – ArthurDM Jun 22 '18 at 16:25
  • 1
    Thanks, the problem is I cannot change the setting by CLI but administration console running in web browser. – ruimo Jun 23 '18 at 00:02
  • 1
    I am skeptical that you "cannot" make the necessary changes with CLI. – covener Jun 24 '18 at 02:39
  • 2
    After you make your changes via the console you can do a `docker commit` to create a new image that you can then use. See this for more info: https://docs.docker.com/engine/reference/commandline/commit/ – ArthurDM Jun 25 '18 at 14:30
  • Whether you *can* do everything with CLI isn't the only question. For some scenarios, it's useful and easier to be able configure/install through the admin console. Thus, I think, the request for how to do that and persist it. – dbreaux Jun 26 '18 at 13:47