Docker Deployment
Deploy Ignite within Docker containers.
This is a legacy Apache Ignite documentation
The new documentation is hosted here: https://ignite.apache.org/docs/latest/
Docker allows packaging Ignite deployment with all the dependencies into a standard container. Docker automates downloading the Ignite release, deploying users' library into Ignite, and configuring nodes. It also automatically starts up a fully configured Ignite node. Such integration allows users to deploy new code by simply restarting the Ignite docker container.
To run a docker container, you need to pull and start a docker image. By default, the latest version is downloaded. You can see a full list of tags here.
Downloading Ignite Docker Image
To pull the Ignite docker image, use the following command:
# Pull latest version.
sudo docker pull apacheignite/ignite
# Pull a specific Ignite version {ignite-version}
sudo docker pull apacheignite/ignite:{ignite-version}
Running Ignite Docker Image for In-Memory Cluster
Use the following command to run the Ignite docker container:
# Run latest version.
sudo docker run -it --net=host \
-e "CONFIG_URI=$CONFIG_URI" \
-e "OPTION_LIBS=$OPTION_LIBS" \
-e "JVM_OPTS=$JVM_OPTS" \
apacheignite/ignite
# Run a specific Ignite version
sudo docker run -it --net=host \
-e "CONFIG_URI=$CONFIG_URI" \
-e "OPTION_LIBS=$OPTION_LIBS" \
-e "JVM_OPTS=$JVM_OPTS" \
apacheignite/ignite:{ignite-version}
The following configuration parameters can be passed as environment variables in the docker container:
Name | Description | Default | Example |
---|---|---|---|
CONFIG_URI | URL to the Ignite configuration file (can also be relative to the META-INF folder on the class path). The downloaded config file will be saved to ./ignite-config.xml | N/A | https://raw.githubusercontent.com/apache/ignite/master/examples/config/example-cache.xml |
OPTION_LIBS | Ignite optional libs which will be included in the class path. | ignite-log4j, | ignite-aws, ignite-aop |
JVM_OPTS | Environment variables passed to the Ignite instance in your docker command. | N/A | -Xms1g -Xmx1g -server -XX:+AggressiveOpts -XX:MaxPermSize=256m |
EXTERNAL_LIBS | List of URL's to libs. | N/A |
Running Ignite Docker Image for Persistent Cluster
If you use Ignite Persistence, Ignite will store the user data under the default work directory ({IGNITE_HOME}/work
) on the file system of the container. This directory will be erased if you restart the docker container. To avoid this, you can:
- use a persistent volume to store the data; or
- mount a local directory.
These two options are described in the following sections.
Using Persistent Volume
To create a persistent volume, run the following command:
sudo docker volume create persistence-volume
We will mount this volume to a specific directory when running the Ignite docker image. This directory will have to be passed to Ignite. This can be done in two ways:
- Using the
IGNITE_WORK_DIR
system property. - In the node configuration file.
The following command launches the Ignite Docker image and passes the work directory to Ignite via the system property:
docker run -d \
-v persistence-volume:/persistence \
-e IGNITE_WORK_DIR=/persistence \
apacheignite/ignite
If you want to configure the work directory via the xml configuration file or programmatically, you can do this by setting the IgniteConfiguration.workDirectory
property. Make sure that you set this property to the same value that is specified in the -v option of the docker run
command given above.
Using Local Directory
Instead of creating a volume, you can mount a local directory to the container in which Ignite image is running and use this directory to store persistent data. When restarting the container with the same command, Ignite will load the existing data.
mkdir ignite_work_dir
docker run -d \
-v ${PWD}/ignite_work_dir:/persistence \
-e IGNITE_WORK_DIR=/persistence \
apacheignite/ignite
The -v
option mounts a local directory under the /persistence
path in the container. The -e IGNITE_WORK_DIR=/persistence
option tells Ignite to use this folder as the work directory.
Example
To run Ignite docker container, use the following command:
sudo docker run -it --net=host -e "CONFIG_URI=https://raw.githubusercontent.com/apache/ignite/master/examples/config/example-cache.xml" apacheignite/ignite
You should see the following in the logs:

Updated 2 months ago