error mounting "/opt/docker-compose/couchdb/local.ini"
This is my docker-compose.yml
services:
couchdb:
image: couchdb:latest
container_name: couchdb
environment:
- COUCHDB_USER=username
- COUCHDB_PASSWORD=password
volumes:
- ./data:/opt/couchdb/data
- ./local.ini:/opt/couchdb/etc/local.ini
ports:
- 5984:5984
restart: unless-stopped
networks:
- internet
networks:
internet:
external: true
root@stormy /opt/docker-compose/couchdb # docker compose up -d [+] Running 0/1 ⠸ Container couchdb Starting 0.3s 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 "/opt/docker-compose/couchdb/local.ini" to rootfs at "/opt/couchdb/etc/local.ini": mount /opt/docker-compose/couchdb/local.ini:/opt/couchdb/etc/local.ini (via /proc/self/fd/6), flags: 0x5000: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
Thank you for opening the issue!
Possibly, expanding the relative path to the absolute path helps this problem.
Would you mind if I ask you to try so?
Thank you for answering! I am trying to fix it since two week, so I am very glad you answered me :D
Do you mean by absolute path the full path?
services:
couchdb:
image: couchdb:latest
container_name: couchdb
#user: 1000:1000
environment:
- COUCHDB_USER=username
- COUCHDB_PASSWORD=password
volumes:
- /opt/docker-compose/couchdb/data:/opt/docker-compose/couchdb/data
- /opt/docker-compose/couchdb/local.ini:/opt/docker-compose/couchdb/local.ini
# Ports not needed when already passed to Traefik
ports:
- 5984:5984
restart: unless-stopped
networks:
- intranet
networks:
intranet:
external: true
I am still getting an error but a different
couchdb |
couchdb | [error] 2024-07-02T09:12:56.842198Z nonode@nohost emulator -------- Error in process <0.980.0> with exit value:
couchdb | {database_does_not_exist,[{mem3_shards,load_shards_from_db,[<<"_users">>],[{file,"src/mem3_shards.erl"},{line,430}]},{mem3_shards,load_shards_from_disk,1,[{file,"src/mem3_shards.erl"},{line,405}]},{mem3_shards,load_shards_from_disk,2,[{file,"src/mem3_shards.erl"},{line,434}]},{mem3_shards,for_docid,3,[{file,"src/mem3_shards.erl"},{line,100}]},{fabric_doc_open,go,3,[{file,"src/fabric_doc_open.erl"},{line,39}]},{chttpd_auth_cache,ensure_auth_ddoc_exists,2,[{file,"src/chttpd_auth_cache.erl"},{line,214}]},{chttpd_auth_cache,listen_for_changes,1,[{file,"src/chttpd_auth_cache.erl"},{line,160}]}]}
The couchdb container image uses /opt/couchdb/data as a working directory NOT /opt/docker-compose/couchdb. So the directory after the semi-colon should be so. Correct example:
volumes:
- /opt/docker-compose/couchdb/data:/opt/couchdb/data
- /opt/docker-compose/couchdb/local.ini:/opt/couchdb/etc/local.ini
read the errors:
Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type