I want to have a persistent file created by the application, that can also be changed with an editor, for example

I develop the program under Window, it should run on a server with Ubunto 16. There is a file that is created, read and written by the application. Under Windows I ran the docker build command, created a .tar archive with “docker save …” and uploaded it to the Ubunto server. With “docker load …” I extracted the .tar archive. The file in question is located in the /permstorage directory with the name mydata.json.

I then tried everything possible with:
docker run --mount …”, but did not get a satisfactory result. I couldn’t find a file anywhere that was readable, editable. The task doesn’t seem particularly difficult, but I still can’t solve it. I am a beginner, this is my first client-server application development (so far I had to learn a lot!). I am therefore particularly grateful if someone shows me how to do it.

Thank you in advance
Gert

docker run --name tracks_docker --network host --mount src=mydata.json,target=/permstorage tracks_docker

docker volume inspect mydata.json:
[
{
“CreatedAt”: “2020-07-25T10:27:45+02:00”,
“Driver”: “local”,
“Labels”: null,
“Mountpoint”: “/var/lib/docker/volumes/mydata.json/_data”,
“Name”: “mydata.json”,
“Options”: null,
“Scope”: “local”
}
]

ls /var/lib/docker/volumes/mydata.json/_data -> empty!

But: running the application outside from docker:
permstorage/mydata.json is filled with data!

What am I doing wrong?

Thank you!

I believe that you will have an easier time manipulating this if you use the docker-compose approach, with a YAML file to do the setup even for one container: https://docs.docker.com/compose/reference/
In your compose.yml file, you can specify volume mappings between the container(s) and the host.
You might need to manipulate the permissions on your shared volume until the container can see it.

You can easily manipulate and monitor your container(s) with Portainer:


Among other features, Portainer will allow you to directly launch a shell in a container from the “Quick actions” menu (>_). This allows quick access to your container. The default is bash , but if this is not available in a given container you may be able to launch sh instead.