Winnik
Winnik

Reputation: 23

docker commit influxdb - no changes in result image

I have big problem with influxdb docker image. I want to save data, databases and tables to file, move file to another host and then restore container with full configuration and data. I tied:

1. docker save / load
2. docker export / import
3. docker commit / run

For influxdb official docker image commands above don't save changes... Everytime container was "clean" with only initial configuration. I have no idea what is wrong... command:

docker diff

only confirms that no changes was saved.

Thank You for Your time and answers.

Upvotes: 0

Views: 291

Answers (2)

user4516335
user4516335

Reputation:

I tried to save some changes in the influxdb (commit) and starting a new container using the new Image created. Let me list down the steps I took:

  1. docker pull influxdb -----> image: 646d62fcef78
  2. docker run -ti influxdb /bin/bash ----> container C1
  3. In C1: mkdir ~/testing123
  4. Ctrl+p+q ----> Get out of the container
  5. docker commit C1 ----> 30d103f44698
  6. docker tag 30d103f44698 new_influxdb ----> Tag the new image
  7. docker run -ti new_influxdb /bin/bash ----> Container C2

In C2, When I checked the change that I made (~/testing123), I was able to see that it was present.

You might be using the same image. A new Image is created after the docker commit.

P.S.: Couldn't comment, that's why had to post it as an answer.

Upvotes: 0

Farhad Farahi
Farhad Farahi

Reputation: 39277

You need to mount volumes at database location:

docker run -p 8083:8083 -p 8086:8086 \
      -v $PWD:/var/lib/influxdb \
      influxdb

This will mount current location as bind mount to /var/lib/influxdbin the container (this is where influxdb stores databases.) Then you can tarball the bind mount on docker host and move it to the new host.

Now To the problem:

InfluxDB's Dockerfile declares /var/lib/influxdb as a volume. Volumes are not affected with docker commit.

VOLUME /var/lib/influxdb

Upvotes: 1

Related Questions