bogdan_uman
@bogdan_uman
шлЫмазл неукЪ-поцЪ

Postges примонтировать в локальную папку на Windows?

Использую Windows 10 x64. Подскажите пожалуйста.
Если задать локальную папку для примонтирования, тогда возникает такая ошибка.
docker-compose.yml
version: '3.6'
services:
  db:
    image: postgres:10.3
    ports:
      - "5432:5432"
    volumes:    
      - ./postgres:/var/lib/postgresql/data
    environment:
      POSTGRES_PASSWORD: postgres


ошибка
spoiler
PS D:\ProjectRuby\RailsDocker> docker-compose up
Creating network "railsdocker_default" with the default driver
Creating railsdocker_db_1 ... done
Attaching to railsdocker_db_1
db_1  | The files belonging to this database system will be owned by user "postgres".
db_1  | This user must also own the server process.
db_1  |
db_1  | The database cluster will be initialized with locale "en_US.utf8".
db_1  | The default database encoding has accordingly been set to "UTF8".
db_1  | The default text search configuration will be set to "english".
db_1  |
db_1  | Data page checksums are disabled.
db_1  |
db_1  | fixing permissions on existing directory /var/lib/postgresql/data ... ok
db_1  | creating subdirectories ... ok
db_1  | selecting default max_connections ... 100
db_1  | selecting default shared_buffers ... 128MB
db_1  | selecting dynamic shared memory implementation ... posix
db_1  | creating configuration files ... ok
db_1  | running bootstrap script ... ok
db_1  | performing post-bootstrap initialization ... ok
db_1  | syncing data to disk ... initdb: could not fsync file "/var/lib/postgresql/data/base/1": Invalid argument
db_1  | initdb: could not fsync file "/var/lib/postgresql/data/base/12993": Invalid argument
db_1  | initdb: could not fsync file "/var/lib/postgresql/data/base/12994": Invalid argument
db_1  | initdb: could not fsync file "/var/lib/postgresql/data/base": Invalid argument
db_1  | initdb: could not fsync file "/var/lib/postgresql/data/global": Invalid argument
db_1  | initdb: could not fsync file "/var/lib/postgresql/data/pg_commit_ts": Invalid argument
db_1  | initdb: could not fsync file "/var/lib/postgresql/data/pg_dynshmem": Invalid argument
db_1  | initdb: could not fsync file "/var/lib/postgresql/data/pg_logical/mappings": Invalid argument
db_1  | initdb: could not fsync file "/var/lib/postgresql/data/pg_logical/snapshots": Invalid argument
db_1  | initdb: could not fsync file "/var/lib/postgresql/data/pg_logical": Invalid argument
db_1  | initdb: could not fsync file "/var/lib/postgresql/data/pg_multixact/members": Invalid argument
db_1  | initdb: could not fsync file "/var/lib/postgresql/data/pg_multixact/offsets": Invalid argument
db_1  | initdb: could not fsync file "/var/lib/postgresql/data/pg_multixact": Invalid argument
db_1  | initdb: could not fsync file "/var/lib/postgresql/data/pg_notify": Invalid argument
db_1  | initdb: could not fsync file "/var/lib/postgresql/data/pg_replslot": Invalid argument
db_1  | initdb: could not fsync file "/var/lib/postgresql/data/pg_serial": Invalid argument
db_1  | initdb: could not fsync file "/var/lib/postgresql/data/pg_snapshots": Invalid argument
db_1  | initdb: could not fsync file "/var/lib/postgresql/data/pg_stat": Invalid argument
db_1  | initdb: could not fsync file "/var/lib/postgresql/data/pg_stat_tmp": Invalid argument
db_1  | initdb: could not fsync file "/var/lib/postgresql/data/pg_subtrans": Invalid argument
db_1  | initdb: could not fsync file "/var/lib/postgresql/data/pg_tblspc": Invalid argument
db_1  | initdb: could not fsync file "/var/lib/postgresql/data/pg_twophase": Invalid argument
db_1  | initdb: could not fsync file "/var/lib/postgresql/data/pg_wal/archive_status": Invalid argument
db_1  | initdb: could not fsync file "/var/lib/postgresql/data/pg_wal": Invalid argument
db_1  | initdb: could not fsync file "/var/lib/postgresql/data/pg_xact": Invalid argument
db_1  | initdb: could not fsync file "/var/lib/postgresql/data": Invalid argument
db_1  | ok
db_1  |
db_1  | Success. You can now start the database server using:
db_1  |
db_1  |     pg_ctl -D /var/lib/postgresql/data -l logfile start
db_1  |
db_1  | initdb: could not fsync file "/var/lib/postgresql/data/pg_tblspc": Invalid argument
db_1  |
db_1  | WARNING: enabling "trust" authentication for local connections
db_1  | You can change this by editing pg_hba.conf or using the option -A, or
db_1  | --auth-local and --auth-host, the next time you run initdb.
db_1  | waiting for server to start....2018-04-26 11:47:52.383 UTC [36] FATAL:  data directory "/var/lib/postgresql/data" has wrong ownership
db_1  | 2018-04-26 11:47:52.383 UTC [36] HINT:  The server must be started by the user that owns the data directory.
db_1  |  stopped waiting
db_1  | pg_ctl: could not start server
db_1  | Examine the log output.
railsdocker_db_1 exited with code 1



Файлы в папке создает.
Спасибо.
  • Вопрос задан
  • 3087 просмотров
Пригласить эксперта
Ответы на вопрос 1
Это известное ограничение в Docker для Windows. Семантика отображения файловой системы из каталога Windows в каталог Linux несовершенна, поскольку mount выполняется с помощью CIFS/SMB. Один из вещей, который не будет работать chown (изменение владельца) в файловой системы Windows.
Вероятно, Вы должны использовать именованный том. Этот пост на форуме содержит подробную информацию: https://forums.docker.com/t/data-directory-var-lib...
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы