Upgrading Influx docker to 1.7

influxdb

#1

Hello, I am running influxdb on the 1.6 ubuntu container image. But I want to update to the latest 1.7. I cant seem to find any documentation on the subject. Is there a simple way to update the docker container to 1.7 or do I have to recreate the container?

Any help is much appreciated

Thank you,
Daniel


#2

I’m also having the same problem. Any ideas on how to solve this?


#3

There are two components here we need to consider; first is the Docker image, which is generated from a Dockerfile and packages the application you want to run along with its supporting libraries, and second is the Docker container itself, which is a running instance of the image.

InfluxDB is hosted in an official repository on Docker Hub, which you can find at https://hub.docker.com/r/library/influxdb/. You can also find a list of all the available tags that have been applied to images. We build and distribute images for each component of the TICK stack, so if you’re using those you don’t have to worry about building a new image.

When upgrading to a new version of a containerized application, the general practice is to stop and remove the running container, and start a new container using the image for the new version. Since containers are generally treated as “ephemeral”, any data which you don’t want to lose should be stored either in a Docker volume or on the local disk. You can read more about managing application data in the Docker docs.

When I run InfluxDB in a Docker container on my Raspberry Pi, I use a command that looks like this:

docker run -d \
    -p 8086:8086 \
    -v /var/lib/influxdb:/var/lib/influxdb \
    -v /etc/influxdb:/etc/influxdb \
    --name influxdb \
influxdb:1.6.4

This starts a container using the official influxdb image with the tag 1.6.4, which specifies which version of InfluxDB I want to run. The -v options mount local directories into the container using the bind-mount method, which means that all of my data will be stored on the host, and not in the container. If I want to upgrade the application, I can stop the running container, remove it, and start a new container with InfluxDB 1.7.1, as follows:

docker stop influxdb

docker rm influxdb

docker run -d \
    -p 8086:8086 \
    -v /var/lib/influxdb:/var/lib/influxdb \
    -v /etc/influxdb:/etc/influxdb \
    --name influxdb \
influxdb:1.7.1

The first container stops, is removed, and then the second container starts. Since there are no breaking changes between the version that created the data and the new version, the new container can read the existing data from the disk and start up as expected.