Tôi gặp sự cố khi chạy vùng chứa postgres với thiết lập khối lượng cho thư mục dữ liệu trên máy Mac OS của tôi. Tôi cố gắng để chạy nó như thế này:Chạy vùng chứa postgres với khối lượng dữ liệu qua docker-machine
docker run \
--name my-postgres \
-e POSTGRES_USER=admin \
-e POSTGRES_PASSWORD=password \
-e POSTGRES_DB=some_db_dev \
-v $PG_LOCAL_DATA:/var/lib/postgresql/data \
-d postgres:9.5.1
Mỗi lần tôi nhận được kết quả sau trong nhật ký:
* Starting PostgreSQL
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are enabled.
fixing permissions on existing directory /var/lib/postgresql/data ... ok
initdb: could not create directory "/var/lib/postgresql/data/pg_xlog": Permission denied
initdb: removing contents of data directory "/var/lib/postgresql/data"
Các phiên bản của Docker, Docker máy, VirtualBox và boot2docker là:
docker-machine version 0.6.0, build e27fb87
Docker version 1.10.2, build c3959b1
VirtualBox Version 5.0.16 r105871
boot2docker 1.10.3
Tôi thấy nhiều ấn phẩm về chủ đề này nhưng hầu hết trong số đó là lỗi thời. Tôi đã thử làm các giải pháp tương tự như cho mysql nhưng nó không giúp đỡ.
Có thể ai đó có thể cập nhật cho tôi: có một số giải pháp tồn tại để chạy vùng chứa postgres với khối lượng dữ liệu thông qua docker-máy không?
Cảm ơn!