skip to Main Content

I am using the following standard to mount a local volume into my postgres container as described here: https://hub.docker.com/_/postgres

$ docker run -d 
    --name some-postgres 
    -e POSTGRES_PASSWORD=mysecretpassword 
    -e PGDATA=/var/lib/postgresql/data/pgdata 
    -v /custom/mount:/var/lib/postgresql/data 
    postgres

It worked well for months but since the last docker update to Docker version 27.3.1, build ce1223035a it does not work anymore. I’m using colima on my Mac with the docker engine.

When I run the same command now I get the following error message:

chown: changing ownership of ‘/var/lib/postgresql/data/pgdata’: Permission denied

Why the heck did it work before and now causes issues? As far as I understand the documentation as longs as you keep the standard as mentioned here –> https://github.com/docker-library/postgres/issues/361#issuecomment-490241136
everything should be alright.

Any ideas?

2

Answers


  1. Chosen as BEST ANSWER

    @Yusuf thank you very much that you posted the solution here on stackoverflow as well! I would like to thank you here as well for posting the solution. Changing the vm-type in colima to vz did the trick.

    Thank you very much!


  2. I’ve first seen your comment at docker-library/postgres#361. After further research, I’ve found a solution in Colima repo, here.

    Here is the solution:

    # delete existing instance
    colima delete 
    
    # create a new instance with 'vz' instead of the default 'qemu'
    # vz is macOS Virtualization.Framework
    colima start --vm-type=vz
    

    You can also enable Rosetta 2 emulation for better performance in amd64 emulation:

    colima start --vm-type=vz --vz-rosetta
    

    Alternatively, you can use colima template with the following options to set the default options, to avoid having to pass them to colima start:

    - vmType: qemu
    + vmType: vz
    
    ...
    
    - rosetta: false
    + rosetta: true
    
    ...
    
    # needed when using `colima start --edit`
    # but, you can still set it for good measure even if not using --edit
    - mountType: sshfs
    + mountType: virtiofs
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search