Using Diffusion with Docker Volumes

In our tutorial on Using Diffusion with Docker, we saw how to pull a Diffusion image, start the server, and use a Dockerfile to build your own image on top of Diffusion. In this tutorial, we will look at using Docker Volumes to enable custom configuration and persistence on your Diffusion server, without the need for a Dockerfile. If you are unfamiliar with Docker Volumes we recommend reviewing the official documentation 

If you haven’t already, pull the default image of Diffusion, remembering to specify the required version.  

docker pull pushtechnology/docker-diffusion:6.7.1  

If we run the default image, make some configuration changes on the server, and then stop the container, we will see that the changes have not been persisted when we run the image again. 

Next, we will use the docker volume create command to create a volume with a name of our choice.  

docker volume create diffusion-volume 

To run our image with the volume we will use the -v tag which takes the name of the volume and the destination where the volume will be mounted, in our case this is /opt/diffusion which will allow us to persist all the files for this Diffusion instance. 

docker run -p 8080:8080 -v diffusion-volume:/opt/diffusion pushtechnology/docker-diffusion:6.7.1 

Now, when we run the image, make some configuration changes on the server, and then stop the container, we will see that the changes have been persisted when we run the image again. 

We can test the persistence by saving a new file on a running container.  

Run your image with the volume mounted as above, however this time us the -d tag to run the container in the background. 

docker run -d -p 8080:8080 -v diffusion-volume:/opt/diffusion pushtechnology/docker-diffusion:6.7.1 

Obtain the name of your running container with docker ps, then use the following command to obtain a shell on your container. 

docker exec -it <name> /bin/sh 

Create a test file and then exit the shell and kill the container. 

docker volumes

Now repeat the steps above to run the image and obtain a shell. You will see that our test file ‘hello’ has been persisted and is available in our new container. 

You can now save custom configuration files, licenses, and security stores in dedicated volumes which you can mount as needed. 

 
 

Further reading

The Diffusion Data logo

BLOG

Benchmarking and scaling subscribers

March 15, 2024

Read More about Benchmarking and scaling subscribers/span>

The Diffusion Data logo

BLOG

100 million updates per second - Landmark Diffusion cluster performance

July 02, 2024

Read More about 100 million updates per second - Landmark Diffusion cluster performance/span>

BLOG

Unlocking the Value of ISO 27001 Certification: A Journey of Security and Continuous Improvement

March 25, 2024

Read More about Unlocking the Value of ISO 27001 Certification: A Journey of Security and Continuous Improvement/span>