# Mounting V2.7.0 non-Docker data to v2.7.5 Docker container

**URL:** <https://community.influxdata.com/t/mounting-v2-7-0-non-docker-data-to-v2-7-5-docker-container/33781>\
**Category:** InfluxDB 2\
**Tags:** docker\
**Created:** [April 3, 2024, 7:04am UTC](https://community.influxdata.com/t/mounting-v2-7-0-non-docker-data-to-v2-7-5-docker-container/33781 "2024-04-03T07:04:42Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![roflas](https://avatars.discourse-cdn.com/v4/letter/r/7ab992/32.png) [@roflas](https://community.influxdata.com/u/roflas)\
**Post date:** [April 3, 2024, 7:04am UTC](https://community.influxdata.com/t/mounting-v2-7-0-non-docker-data-to-v2-7-5-docker-container/33781/1 "2024-04-03T07:04:42Z")

</div>

Hey,

I am struggling for the last couple of days to move my current stand-alone influx (V2.7.0) installation to Docker (V2.7.5). I am trying to mount my current non-Docker data and config files to Docker volumes:

```auto
version: '3'

services:

  influxdb:
    image: influxdb:2.7.5
    container_name: influxdb
    env_file:
      - ./env-files/influxdb.env
    volumes:
      - ./influxdb/data:/var/lib/influxdb2
      - ./influxdb/config:/etc/influxdb2
    ports:
      - "8086:8086"
    networks:
      - tig-net

  grafana:
    image: grafana/grafana:10.4.1-ubuntu
    container_name: grafana
    env_file:
      - ./env-files/grafana.env
    volumes:
      - ./grafana/data:/var/lib/grafana
    depends_on:
      - influxdb
    ports:
      - "3000:3000"
    restart: always
    networks:
      - tig-net
    user: "1000:1000"

networks:
  tig-net:
    name: tig-net
    driver: bridge

```

env-file

```auto
DOCKER_INFLUXDB_INIT_MODE=setup
DOCKER_INFLUXDB_INIT_USERNAME=al
DOCKER_INFLUXDB_INIT_PASSWORD=pass
DOCKER_INFLUXDB_INIT_ORG=org
DOCKER_INFLUXDB_INIT_BUCKET=main
DOCKER_INFLUXDB_INIT_RETENTION=0
DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=token

```

What happens is that I simply copy and paste `config` and `data` dirs to appropriate Docker volumes (i.e. host folders). However, each time it loads a container, it runs setup and no data, no configuration is kept. Is it possible to move influx this way to Docker at all? I also tried the same version of container V2.7.0, but no luck. I have also tried to move CLI configurations into `influx-configs` files, but also that did not help and I also got error that `default` configuration already exists.

Thanks

---

<div class="post-metadata">

**Author:** ![scott](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/scott/32/16492_2.png) [@scott](https://community.influxdata.com/u/scott)\
**Post date:** [April 3, 2024, 3:38pm UTC](https://community.influxdata.com/t/mounting-v2-7-0-non-docker-data-to-v2-7-5-docker-container/33781/2 "2024-04-03T15:38:59Z")

</div>

@roflas I don’t believe your volume paths are correct according to the [InfluxDB fs layout for Docker](https://docs.influxdata.com/influxdb/v2/reference/internals/file-system-layout/?t=Docker#file-system-layout). I think it should be:

```yaml
# ...
    volumes:
      - ./influxdb/data:/var/lib/influxdb2/engine/
      - ./influxdb/config:/etc/influxdb2/

```

---

<div class="post-metadata">

**Author:** ![roflas](https://avatars.discourse-cdn.com/v4/letter/r/7ab992/32.png) [@roflas](https://community.influxdata.com/u/roflas)\
**Post date:** [April 3, 2024, 3:57pm UTC](https://community.influxdata.com/t/mounting-v2-7-0-non-docker-data-to-v2-7-5-docker-container/33781/3 "2024-04-03T15:57:16Z")

</div>

Thanks for reply.

I followed this manual: [https://hub.docker.com/\_/influxdb](https://hub.docker.com/_/influxdb)

And it says that `dirs` should be like the ones I used. Am I wrong? If I used your version, how would it know and find `*.bolt` file with last setup? Manual says that if it does not find one, it will rerun setup again.

---

<div class="post-metadata">

**Author:** ![scott](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/scott/32/16492_2.png) [@scott](https://community.influxdata.com/u/scott)\
**Post date:** [April 3, 2024, 4:13pm UTC](https://community.influxdata.com/t/mounting-v2-7-0-non-docker-data-to-v2-7-5-docker-container/33781/4 "2024-04-03T16:13:51Z")

</div>

Ah, I see. `./influxdb/data` contains all the data (both time series and metadata). And you’ve confirmed that the following exist in your local fs?

- `./influxdb/data/engine/`
- `./influxdb/data/engine/data/`
- `./influxdb/data/engine/wal/`
- `./influxdb/data/influxd.bolt`
- `./influxdb/data/influxd.sqlite`

---

<div class="post-metadata">

**Author:** ![roflas](https://avatars.discourse-cdn.com/v4/letter/r/7ab992/32.png) [@roflas](https://community.influxdata.com/u/roflas)\
**Post date:** [April 3, 2024, 4:17pm UTC](https://community.influxdata.com/t/mounting-v2-7-0-non-docker-data-to-v2-7-5-docker-container/33781/5 "2024-04-03T16:17:53Z")

</div>

Yes, I can confirm that all of those dirs do actually exist on host fs.

---

<div class="post-metadata">

**Author:** ![scott](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/scott/32/16492_2.png) [@scott](https://community.influxdata.com/u/scott)\
**Post date:** [April 3, 2024, 4:23pm UTC](https://community.influxdata.com/t/mounting-v2-7-0-non-docker-data-to-v2-7-5-docker-container/33781/6 "2024-04-03T16:23:13Z")

</div>

Try starting the container without the InfluxDB `.env` file. Since you’re mounting already established directories, InfluxDB shouldn’t need to go through the setup process. All of those environment variables are meant to trigger and automate the setup process. I think that’s why it keeps going into setup mode.

These instructions are really meant for standing up a new InfluxDB instance in a Docker container rather than moving an InfluxDB instance from the host machine into a container.

---

<div class="post-metadata">

**Author:** ![roflas](https://avatars.discourse-cdn.com/v4/letter/r/7ab992/32.png) [@roflas](https://community.influxdata.com/u/roflas)\
**Post date:** [April 3, 2024, 4:25pm UTC](https://community.influxdata.com/t/mounting-v2-7-0-non-docker-data-to-v2-7-5-docker-container/33781/7 "2024-04-03T16:25:43Z")

</div>

Without `env`… Nah, it just starts a clean version without using anything I loaded. No luck yet.

---

<div class="post-metadata">

**Author:** ![Jason\_Stirnaman](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/jason_stirnaman/32/14433_2.png) [@Jason\_Stirnaman](https://community.influxdata.com/u/Jason_Stirnaman)\
**Post date:** [April 3, 2024, 4:56pm UTC](https://community.influxdata.com/t/mounting-v2-7-0-non-docker-data-to-v2-7-5-docker-container/33781/8 "2024-04-03T16:56:31Z")

</div>

@roflas `volumes` in a compose file [creates named volumes](https://docs.docker.com/compose/compose-file/07-volumes/), but in your case, you might try specifying bind mount in your compose file to mount your existing fs directories into the container directories.

Alternatively, if you want to use named volumes, you could use the Docker CLI to create them for your existing fs directories and then use them in your compose file.

---

<div class="post-metadata">

**Author:** ![roflas](https://avatars.discourse-cdn.com/v4/letter/r/7ab992/32.png) [@roflas](https://community.influxdata.com/u/roflas)\
**Post date:** [April 3, 2024, 10:49pm UTC](https://community.influxdata.com/t/mounting-v2-7-0-non-docker-data-to-v2-7-5-docker-container/33781/9 "2024-04-03T22:49:03Z")

</div>

Thanks for help. I ended up just setting the system from scratch and restoring the backup. It is now fine although it is still unclear, why I was not able to mount it 🙂

---

<div class="post-metadata">

**Author:** ![pookie](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/pookie/32/15532_2.png) [@pookie](https://community.influxdata.com/u/pookie)\
**Post date:** [April 26, 2024, 9:19am UTC](https://community.influxdata.com/t/mounting-v2-7-0-non-docker-data-to-v2-7-5-docker-container/33781/10 "2024-04-26T09:19:06Z")

</div>

hi @roflas can you tell me what you did for “starting system from scratch” exactly? I’m facing the same issue and I already tried deleting the volumes.

---

<div class="post-metadata">

**Author:** ![roflas](https://avatars.discourse-cdn.com/v4/letter/r/7ab992/32.png) [@roflas](https://community.influxdata.com/u/roflas)\
**Post date:** [April 26, 2024, 9:37am UTC](https://community.influxdata.com/t/mounting-v2-7-0-non-docker-data-to-v2-7-5-docker-container/33781/11 "2024-04-26T09:37:19Z")

</div>

Hey, I just configured basic installation with basic settings (in docker compose file), but later I just restored full backup of my previous DB. Full backup restores everything including tokens etc. So basically you will have the same thing you had before. This way I did not have to worry about using old influx data folders and attaching them to docker volumes, but I “made” good volumes after restoring backup.

Hope that helps.

---

<div class="post-metadata">

**Author:** ![pookie](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/pookie/32/15532_2.png) [@pookie](https://community.influxdata.com/u/pookie)\
**Post date:** [April 26, 2024, 11:29am UTC](https://community.influxdata.com/t/mounting-v2-7-0-non-docker-data-to-v2-7-5-docker-container/33781/12 "2024-04-26T11:29:54Z")

</div>

Thanks a lot @roflas you made our day. I started a plain container without any env set, just like you and went ahead to delete the bolt file in /`var/lib/influxdbv2/data/influxd.bolt.` And later did docker compose to my original file that has env vars. And it worked
