# Error creating a container with Podman and persistent data

**URL:** <https://forums.rockylinux.org/t/error-creating-a-container-with-podman-and-persistent-data/18254>\
**Category:** Rocky Linux Help & Support\
**Tags:** rocky-linux-9, problem\
**Created:** [April 25, 2025, 11:24am UTC](https://forums.rockylinux.org/t/error-creating-a-container-with-podman-and-persistent-data/18254 "2025-04-25T11:24:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![juanqp](https://avatars.discourse-cdn.com/v4/letter/j/b9bd4f/32.png) [@juanqp](https://forums.rockylinux.org/u/juanqp)\
**Post date:** [April 25, 2025, 11:24am UTC](https://forums.rockylinux.org/t/error-creating-a-container-with-podman-and-persistent-data/18254/1 "2025-04-25T11:24:49Z")

</div>

Hello, I’m trying to pull a container in Cockpit using Podman and store its data on an mdraid. The mdraid was created successfully, but when I start the container and it begins to write data to the disk, nothing is created because it lacks permissions. I don’t know how to configure this: I’ve tried changing the user and granting read/write/execute permissions to everyone, but nothing works. The container is Dockge. This is what it returns:

```auto
2025-04-25T11:05:16Z [SERVER] INFO: Welcome to dockge!
2025-04-25T11:05:16Z [SERVER] INFO: NODE_ENV: production
2025-04-25T11:05:16Z [SERVER] INFO: Server Type: HTTP
2025-04-25T11:05:16Z [SERVER] INFO: Data Dir: ./data/
2025-04-25T11:05:16Z [DB] WARN: ENOENT: no such file or directory, open 'data/db-config.json'
2025-04-25T11:05:16Z [SERVER] ERROR: Failed to prepare your database: EACCES: permission denied, open 'data/db-config.json'

```

---

<div class="post-metadata">

**Author:** ![jlehtone](https://avatars.discourse-cdn.com/v4/letter/j/e9a140/32.png) [@jlehtone](https://forums.rockylinux.org/u/jlehtone)\
**Post date:** [April 25, 2025, 1:12pm UTC](https://forums.rockylinux.org/t/error-creating-a-container-with-podman-and-persistent-data/18254/2 "2025-04-25T13:12:19Z")

</div>

First, I don’t know Cockpit.

> [@juanqp](#):
>
> Dockge

Is that the [GitHub - louislam/dockge: A fancy, easy-to-use and reactive self-hosted docker compose.yaml stack-oriented manager](https://github.com/louislam/dockge) ?  
It’s “compose.yaml” seems to define _volumes_.

```yaml
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./data:/app/data
      - /opt/stacks:/opt/stacks

```

The `man podman-run` describes option `--volume` to apparently be a  
shorthand for use of `--mount=type=bind,...`

Logically, the `data` is a subdirectory of the working directory, where you run the ‘podman run’.  
I did not browse deeper to see if/how to create the file `data/db-config.json` _before_ you run the container.

It does look like that the “/opt/stacks” is for the “store its data on” and you would either mount the filesystem on the mdraid as `/opt/stacks` on the host, or modify that in the compose.yaml.

---

<div class="post-metadata">

**Author:** ![hs303](https://avatars.discourse-cdn.com/v4/letter/h/e47774/32.png) [@hs303](https://forums.rockylinux.org/u/hs303)\
**Post date:** [April 25, 2025, 1:27pm UTC](https://forums.rockylinux.org/t/error-creating-a-container-with-podman-and-persistent-data/18254/3 "2025-04-25T13:27:19Z")

</div>

`SELinux` might be preventing the writes by the container. If it is enabled, you need to make sure the folders are labeled with `container_file_t`. On the command line you can achieve it by adding `:Z` to your volume: `podman run -d -v ./data:/app/data:Z --name mycontainer myimage`. I guess it should work with `compose` as well. On the volume definition you can try something like this:

```auto
    volumes:
      - ./data:/app/data:Z

```

---

<div class="post-metadata">

**Author:** ![juanqp](https://avatars.discourse-cdn.com/v4/letter/j/b9bd4f/32.png) [@juanqp](https://forums.rockylinux.org/u/juanqp)\
**Post date:** [April 25, 2025, 1:27pm UTC](https://forums.rockylinux.org/t/error-creating-a-container-with-podman-and-persistent-data/18254/4 "2025-04-25T13:27:28Z")

</div>

I found that the problem is SELinux blocking access to the RAID, thanks anyway.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/rockylinux/original/1X/91b7219eec10e30013422e4df76c1d898711a5d5.svg) [@system](https://forums.rockylinux.org/u/system)\
**Post date:** [June 24, 2025, 1:28pm UTC](https://forums.rockylinux.org/t/error-creating-a-container-with-podman-and-persistent-data/18254/5 "2025-06-24T13:28:16Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
