Skip to main content
Skip table of contents

Rebuilding Your Docker Compose Environment

If you're working in an existing repo or are running into errors, you may want to start from a clean environment, rebuilding the XNAT image, downloading the latest versions of the XNAT war and plugins, and resetting the database and archive contents. There are a number of places where data may be cached that you'll need to clear to ensure you're getting the latest versions of all dependencies and have cleared out all existing data stores.

  1. Make sure all containers have been shut down or killed.
  2. Remove all locally built images. For the standard docker-compose deployment, this means xnat-web, xnat-db, and xnat-orthanc. You may want to check the list of local images to make sure only downloaded images are stored locally.
  3. Prune all unused Docker volumes.
  4. Remove all *-data data folders. These folders contain, amongst other things, the XNAT database, archive folders, downloaded war and plugin jars, and so on.
  5. Remove all version folders for the XNAT war and plugins in the local Maven and Gradle cache.

For the first step, you should first shut down any running docker-compose configurations:

$ docker-compose down

You can use the following command to verify that nothing is left running:

$ docker ps --all

The --all flag includes containers that were launched but stopped for some reason. If you still have individual containers running, use the following command to kill them:

$ docker kill <name>

To remove locally build images, first list all of the images cached locally, then remove anything that was built locally:

$ docker images
REPOSITORY                           TAG                                              IMAGE ID            CREATED             SIZE
xnat-orthanc                         latest                                           ed0f640665a3        35 minutes ago      265MB
xnat-db                              latest                                           bd98a8897207        36 minutes ago      151MB
xnat-web                             latest                                           71780692637b        36 minutes ago      609MB
traefik                              latest                                           3d0acfd4b500        3 weeks ago         76.8MB
jodogne/orthanc-plugins              latest                                           f2854b307c42        5 weeks ago         208MB
postgres                             12.2-alpine                                      ecb176ff304a        2 months ago        151MB
tomcat                               7-jre8-alpine                                    d3deaf2d7b68        12 months ago       107MB
webcenter/activemq                   5.14.3                                           ab2a33f6de2b        3 years ago         422MB
$ docker rmi xnat-web xnat-db xnat-orthanc

Pruning volumes means that Docker deletes any volumes that aren't referenced by a currently running container:

$ docker volume prune

Data is also stored in the various *-data folders created by docker-compose. You can remove these with something like this:

$ rm -rf *-data

Lastly, to make sure you're getting the latest "official" build of the XNAT war and various plugins, you can purge your local Maven and Gradle repository caches to force the dependency management functionality to download those artifacts from the XNAT Maven repository. You could just delete your entire Maven and Gradle repositories (minus some things like settings.xml and files), but then subsequent builds would take quite a while until cached items like plugins and wrappers have downloaded again. Instead you could just delete the folders containing the artifacts specified in your manifest.json file. For example, based on the manifest for XNAT-ML shown in the Docker-Compose Setup Instructions, you could run a script like this:

for FILE in $(find ~/.m2/repository ~/.gradle -name "xnat-web-ML-*.war" -o -name "batch-launch-ML-*.jar" -o -name "container-service-ML-*.jar" -o -name "dicom-query-retrieve-*.jar" -o -name "xnatx-clara-ML-*.jar" -o -name "xnatx-collection-*.jar" -o -name "ohif-viewer-*.jar"); do
    rm -rf $(dirname ${FILE})

The file names are all based on the artifact ID and version, with a wildcard (*) to account for potential variances in the names from development or future release builds. Deleting the folder containing the file (accomplished by using dirname rather than the file name directly) ensures that the metadata associated with the jar or war file is also deleted.

At this point, your build and execution environment for the docker-compose project should be clean and your build should comprise only the latest canonical versions of the specified dependencies.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.