Search code examples
javatomcatdockerhsqldb

Docker Volume not saving


In my Dockerfile, I have this line to create a data volume

VOLUME /Infrared360SA

I see that this volume was created by running the following:

zack@zack-Inspiron-5748:~/Docker$ sudo docker volume inspect Infrared360SA
[
    {
        "Driver": "local",
        "Labels": null,
        "Mountpoint": "/var/lib/docker/volumes/Infrared360SA/_data",
        "Name": "Infrared360SA",
        "Options": {},
        "Scope": "local"
    }
]

When I run my application via docker run however, I'm not seeing data persist underneath that directory. The application I'm trying to run is an embedded tomcat web app that uses an hsql database. I can run this web application no problem from the command line via a java startup command and see database changes persist to hsql but when I run the same exact command in the Docker container data is not persisting.

How do I get data to persist inside the volume I defined?


Solution

  • If you correclty created your docker volume with docker volume create.

    You should bind your docker-volume with your dockerfile volume in the docker run command. This way :

    sudo docker run -v Infrared360SA:/Infrared360SA avada/ir360sa-5.8.2.0 avada/ir360sa-5.8.2.0