Thread

  1. Issue with PostgreSQL 18.0 Docker image volume mount (/var/lib/postgresql/data symlink)

    Pavel Hushcha <paul.fastest@gmail.com> — 2025-09-26T05:53:09Z

    Hello,
    
    I’ve encountered a problem when trying to upgrade from the `postgres:17.6` Docker image to `postgres:18.0`.
    
    With PostgreSQL 17.6, the volume mapping worked fine:
    
    ```yaml
    volumes:
      - /volumeUSB1/usbshare1-6/configs/postgresql/data:/var/lib/postgresql/data/
    ```
    
    However, with `postgres:18.0`, the container fails to start with the following error:
    
    ```
    Error response from daemon: failed to create task for container: failed to create shim task: 
    OCI runtime create failed: runc create failed: unable to start container process: 
    error during container init: error mounting "/volumeUSB1/usbshare1-6/configs/postgresql/data" 
    to rootfs at "/var/lib/postgresql/data": change mount propagation through procfd: 
    open o_path procfd: open /volumeUSB1/usbshare1-6/docker/btrfs/subvolumes/362b5618ea6ff38caa0671921e892066b3ad705e39270f938aac396f7401781e/var/lib/postgresql/data: 
    no such file or directory: unknown
    ```
    
    I noticed that the difference is in the Docker image itself:
    
    * In 17.6, `/var/lib/postgresql/data` is a real directory.
    * In 18.0, `/var/lib/postgresql/data` is a symlink to `.`.
    
    
    This change seems to break bind mounts on some storage backends (in my case, Btrfs on a Synology NAS).
    
    Could you confirm if this symlink change in the official PostgreSQL 18.0 Docker image is intentional?
    And if so, is there a recommended way to mount external volumes for `PGDATA` now?
    
    Thanks,
    Pavel Hushcha
    
    
    
    
    
  2. Re: Issue with PostgreSQL 18.0 Docker image volume mount (/var/lib/postgresql/data symlink)

    Magnus Hagander <magnus@hagander.net> — 2025-09-26T09:14:08Z

    On Fri, Sep 26, 2025, 12:05 Pavel Hushcha <paul.fastest@gmail.com> wrote:
    
    > Hello,
    >
    > I’ve encountered a problem when trying to upgrade from the `postgres:17.6`
    > Docker image to `postgres:18.0`.
    >
    > With PostgreSQL 17.6, the volume mapping worked fine:
    >
    > ```yaml
    > volumes:
    >   -
    > /volumeUSB1/usbshare1-6/configs/postgresql/data:/var/lib/postgresql/data/
    > ```
    >
    > However, with `postgres:18.0`, the container fails to start with the
    > following error:
    >
    > ```
    > Error response from daemon: failed to create task for container: failed to
    > create shim task:
    > OCI runtime create failed: runc create failed: unable to start container
    > process:
    > error during container init: error mounting
    > "/volumeUSB1/usbshare1-6/configs/postgresql/data"
    > to rootfs at "/var/lib/postgresql/data": change mount propagation through
    > procfd:
    > open o_path procfd: open
    > /volumeUSB1/usbshare1-6/docker/btrfs/subvolumes/362b5618ea6ff38caa0671921e892066b3ad705e39270f938aac396f7401781e/var/lib/postgresql/data:
    >
    > no such file or directory: unknown
    > ```
    >
    > I noticed that the difference is in the Docker image itself:
    >
    > * In 17.6, `/var/lib/postgresql/data` is a real directory.
    > * In 18.0, `/var/lib/postgresql/data` is a symlink to `.`.
    >
    >
    > This change seems to break bind mounts on some storage backends (in my
    > case, Btrfs on a Synology NAS).
    >
    > Could you confirm if this symlink change in the official PostgreSQL 18.0
    > Docker image is intentional?
    > And if so, is there a recommended way to mount external volumes for
    > `PGDATA` now?
    >
    
    
    Hello!
    
    Those docker containers are not provided by the PostgreSQL project. You
    need to contact the docker team for questions about those.
    
    /Magnus
    
    >