---
title: "Migration: Migrating from Docker image 5.x or lower to 6.0 or higher"
description: "* Starting with version 6.0, RavenDB for Docker introduces an improved security model, using a dedicated user rather than root."
url: "https://docs.ravendb.net/6.2/migration/server/docker"
version: "6.2"
---

# Migration: Migrating from Docker image 5.x or lower to 6.0 or higher

> RavenDB publishes an official agent skill for coding assistants at https://docs.ravendb.net/skills/ravendb/SKILL.md (also installable with `npx skills add ravendb/skills`). The skill describes itself as: "Read this before writing any RavenDB query, client call or /databases/ request. Covers server setup, document modelling, the Node.js, .NET and Python clients, RQL, indexes, vector search and AI agents. Code written from recall tends to run and return the wrong rows, because RQL resembles SQL and the clients take field names as plain strings."

## Migration: Migrating from Docker image 5.x or lower to 6.0 or higher

> **Note**
>
> - Starting with version `6.0`, RavenDB for Docker introduces an improved security model, using a dedicated user rather than `root`.
>
> - RavenDB `6.0` and up also use a Debian archive file
>   ([.deb package](https://docs.ravendb.net/6.2/start/installation/gnu-linux/deb.md)), applying a uniform internal structure for Ubuntu OS platforms.
>
> - To conform with these changes, installing RavenDB `6.0` or higher in a system that already hosts RavenDB `5.x` or lower requires the migration procedure explained below.
>
> - Read [here](https://docs.ravendb.net/6.2/start/containers/image-usage.md) more about running a RavenDB Docker image.
>
> - In this article:
>   - [Changes Made In RavenDB `6.0` And Up](#changes-made-in-ravendb-6-0-and-up)
>   - [Migrating To RavenDB `6.0` And Up](#migrating-to-ravendb-6-0-and-up)
>     - [Permit the `ravendb` user to access the mounted data directory](#permit-the-ravendb-user-to-access-the-mounted-data-directory)
>     - [Customize the UID/GID of the RavenDB data directory owner](#customize-the-uidgid-of-the-ravendb-data-directory-owner)
>     - [Migrate files and data](#migrate-files-and-data)

## Changes Made In RavenDB 6.0 And Up {#changes-made-in-ravendb-6-0-and-up}

The **directory structure** used by RavenDB of version `6.0` and above, and the **user** we use to run RavenDB, are different from the directory structure and user used by older versions.

- RavenDB Docker images up to `5.x`:
  - Create a unique directory structure under Windows.
  - Are installed and accessed using the `root` user on Ubuntu.

- RavenDB Docker images from `6.0` up:
  - Use a Debian archive file ([.deb package](https://docs.ravendb.net/6.2/start/installation/gnu-linux/deb.md))
    and create a similar directory structure under Windows and Ubuntu.
  - Are installed and accessed using a dedicated `ravendb` user instead of `root`, to improve security.

Learn below how to address these differences when migrating from version `5.x` or lower to version `6.0` or higher.

## Migrating To RavenDB \`6.0\` And Up {#migrating-to-ravendb-6-0-and-up}

### Permit the `ravendb` user to access the mounted data directory

The default **UID** (User ID) and **GID** (Group ID)
used by `ravendb` are **999**.  
Change the RavenDB data directory owner to `ravendb` (`999` UID by default) on the container host.  
E.g.,

```bash
chown -R 999:999 $TARGET_DATA_DIR
```

### Customize the UID/GID of the RavenDB data directory owner

To customize the **UID** and **GID** of the `ravendb` user (e.g. to match your host user or for volume permissions), you can build your own image using the official `ravendb` base image.

```dockerfile
FROM ravendb/ravendb:7.2-ubuntu-latest

ARG USER_ID=1000
ARG GROUP_ID=1000

USER root

RUN groupmod -g "${GROUP_ID}" "ravendb" && \
usermod  -u "${USER_ID}" -g "${GROUP_ID}" ravendb && \
chown root:"${USER_ID}" /etc/ravendb/settings.json && \
find / -xdev -uid 0 -gid 999 -exec chown "root:${GROUP_ID}" {} +

USER ravendb
```

> **Info:** Build Instructions
>
> 1. Save the above as `dockerfile`
> 2. Open a terminal in that directory
> 3. Build the custom image with your UID and GID:
>
> ```bash
> docker build --build-arg USER_ID=YourUserID --build-arg GROUP_ID=YourGroupID -t image-name -f dockerfile
> ```

### Migrate files and data

The setup process will create the directory structure detailed
[here](https://docs.ravendb.net/6.2/start/installation/gnu-linux/deb.md#file-system-locations).

The script within the image will attempt to link the old version's
data directory to the new version's data directory automatically upon start.  
If this attempt fails, an error will be produced.

When mounting a host directory, make sure that **RavenDB data** is mounted under its new location on the container: `/var/lib/ravendb/data`

Old data directory (default): `/opt/RavenDB/Server/RavenData`  
New data directory (default): `/var/lib/ravendb/data`
