Changes To River4 Docker Image

The latest version of the River4 Docker image now supports volumes, which provides for data to persist across a container. NOTE: If you use Kitematic to run the River4 container, there are some slight differences to how this works, which I will write about in another article.

Changes:

  • Create the river4data and subdirectories at build time (see Dockerfile)

  • Copy my full readinglist.opml to the /river4data/lists directory during build

  • Changed the CMD so that River4 is run from the root directory so that it finds river4data where it expects to find it as a subdirectory off root.

  • Mount /river4data as a volume during build.

You can run the container as before, it will now use the default readinglist without include.

docker run --name river4 -d -p 1337:1337 fmcpherson/river4

  • NOTE: Naming the container makes it easier to manage, that is what --name does.

Confirm entering by docker logs river4

If you are running Docker Engine 1.8 or newer, you can use the docker cp command to copy your own readinglist.opml file in to the /river4data/lists directory in the container by entering the following (assuming the readinglist.opml is in the current directory, and you have named your container river4)

  • docker cp readinglist.opml river4:/river4data/lists

NOTE: The above change will not persist, if you shut down the container, the next time it starts will start up with the originally provided readinglist.opml. You can re-run the docker cp command after starting up the container to overwrite the file.

If you want the changes you make to readinglist.opml to persist, you need to "map" a local directory on your computer to the /river4data mount in the container. For example, assume you have a directory on your computer called /river, to start the river4 container in a way that data persists enter the following run command.

  • docker run --name river4 -d -p 1337:1337 -v /river:/river4data fmcpherson/river4

Now, if you overwrite the readinglist.opml with your own copy, it will persist after you shutdown the river4 container, provided you execute the run statement exactly as provided above.

After running the container, to overwrite enter

  • docker cp readinglist.opml river4:/river4data/lists

After this, the change you just made will persist, again provided you include the -v flag in the docker run statement as provided above.

If the -v flag is not included and you enter "docker run --name river4 -d -p 1337:1337 fmcpherson.river4" the original readinglist provided in the image will be used by the container.


Last built: Wed, Feb 17, 2016 at 3:26 PM

By Frank McPherson, Monday, August 17, 2015 at 5:03 PM. Welcome back my friends to the show that never ends.