create(...) currently allows only host as UsernsMode. This seems to make sense as docker only allows this as an option. However, podman supports a few others. I assume this package should be able to interact with other docker-compatible APIs, and in that case it would make sense that we can set this parameter differently.
Right now, the only workaround I've found was to use the low level API as such:
host_config = api_client.create_host_config(
binds={
socket_dir: {'bind': '/var/run/postgresql', 'mode': 'rw'},
data_dir: {'bind': '/var/lib/postgresql/data', 'mode': 'rw'},
}
)
# kind of hacky, right?
host_config['UsernsMode'] = 'keep-id'
container_config = api_client.create_container(
image=POSTGRES_IMAGE,
name=CONTAINER_NAME,
user=f'{os.getuid()}:{os.getgid()}',
host_config=host_config,
environment={'POSTGRES_USER': 'postgres', 'POSTGRES_PASSWORD': 'postgres', 'POSTGRES_DB': db_name},
)
create(...)currently allows onlyhostasUsernsMode. This seems to make sense as docker only allows this as an option. However, podman supports a few others. I assume this package should be able to interact with other docker-compatible APIs, and in that case it would make sense that we can set this parameter differently.Right now, the only workaround I've found was to use the low level API as such: