Updating applications inside running Docker containers
You might encounter some situations where you need to directly update applications that are running inside the Docker containers.
For example, you might want to test new classes, libraries, or debug issues on a local
test, quality assurance, or authoring environment before you decide to make
the changes in your production environment. This procedure explains how to copy files from your
local Docker host into the running containers.
Note: If your environment is managed by Docker
orchestration tools (such as Marathon), ensure that you follow the recommended guidelines of
building new Docker images to deploy. Otherwise, your copied files will be lost after a restart due
to the nature or orchestration tools. For more information about building new images, see Building a custom Docker image from a deployable package.
If you still must copy files, note that sometimes replacing files requires you to restart the entire Docker container before your changes take effect. You can implement third party technical solutions to restart the JVM inside the container instead of restarting the container.
About this task
Procedure
-
Copy your file to the Docker container.
Method Explanation By using 'docker cp'
commanddocker cp <local_file> <container_name>:<destination_path>
For example, to update the Transaction container (named set_app_1) with myupdate.jar, usedocker cp myupdate.jar setup_app_1:/opt/WebSphere/AppServer/profiles/default/installedApps/localhost/ts.ear/lib
By using a Docker volume driver to mount the local file into the target Docker container For more information about volume drivers, see the Docker documentation, Use a volume driver. -
Restart.
- For updates to Store and Search containers, restart the containers. For
example,
docker restart store, search
- For Transaction server, you can restart the Transaction container or restart the Transaction EAR
from the WebSphere Application Server Administrative console. To restart in the WebSphere
Application Server Administrative Console:
- Log in to the WebSphere Application Server Administrative Console https://hostname:9043/ibm/console.
- Click Servers > Server Types > WebSphere application servers.
- Select server1 and click Restart.
- For updates to Store and Search containers, restart the containers. For
example,