I'm trying to run couchdb via docker-compose:
version: '3'
services:
couchdb:
image: "couchdb:2"
restart: always
ports:
- 5984:5984
volumes:
- /data/couchdb:/opt/couchdb/etc/
- /data/couchdb_config:/opt/couchdb/etc/local.d
environment:
- COUCHDB_USER=myuser
- COUCHDB_PASSWORD=mypassword
the container crashes during start:
Failed to open arguments file "/opt/couchdb/bin/../etc/vm.args": No such file or directory
Usage: erl......
grep: /opt/couchdb/etc/default.d/*.ini: No such file or directory
In data/couchdb_config I am providing a standard local.ini file. When I don't do that, couchdb complains that it's missing as well.
What's the problem here?
you need to set points before data path .Docker-comose need to know that data is in the same path as the docker-compose file
version: '3'
services:
couchdb:
image: "couchdb:2"
restart: always
ports:
- 5984:5984
volumes:
- ./data/couchdb:/opt/couchdb/etc/
- ./data/couchdb_config:/opt/couchdb/etc/local.d
environment:
- COUCHDB_USER=myuser
- COUCHDB_PASSWORD=mypassword
The error was the mapping of a wrong volume:
my_couchdb_data:/opt/couchdb/etc
should be
my_couchdb_data:/opt/couchdb/data
Related
Hello I want to publish the "index.php" from the local folder "C:\html\index.php" with docker-compose.yml
in localhost I get the typical apache html "It works". But I do not get the content of my local folder. What I am doing wrong?
here is my docker-compose file:
version: "3"
services:
# --- MySQL 5.7
#
mysql:
container_name: "dstack-mysql"
image: bitnami/mysql:5.7
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_USER=admin
- MYSQL_PASSWORD=root
ports:
- '3306:3306'
php:
container_name: "dstack-php"
image: bitnami/php-fpm:8.1
# --- Apache 2.4
#
apache:
container_name: "dstack-apache"
image: bitnami/apache:2.4
ports:
- '80:8080'
- '443:8443'
depends_on:
- php
volumes:
- C:/html:/var/www/html
phpmyadmin:
container_name: "dstack-phpmyadmin"
image: bitnami/phpmyadmin:latest
depends_on:
- mysql
ports:
- '81:8080'
- '8143:8443'
environment:
- DATABASE_HOST=host.docker.internal
volumes:
dstack-mysql:
driver: local
Update:
volumes:
- ./html:/var/www/html
Doesn't works.
I want to have a web development docker environment where I edit in the folder C:\html\index_hello.html in my computer and I will see the changes in the browser localhost:8080, the changes I did. My expectation is that I write in the browser http://localhost:8080/index_hello.html. Did I something wrong? shall I edit other files e.g. apache.conf?
I would suggest avoiding hardcoding directories and using relative directories.
If you place your docker-compose into your C:/html folder and then change you volume to read:
volumes:
- .:/var/www/html
if you run the following:
cd C:/html
docker-compose up -d
you are telling docker-compose to use . meaning the current directory.
if you put the docker-compose.yml in the C:/ directory you can run change the volume to:
volumes:
- ./html:/var/www/html
then the docker compose command should remain the same.
I am a newbie in the docker world and while doing some tutorials I encountered the following error:
yaml: line 1: did not find expected key
This is my .YAML file:
version: '3'
services:
mongodb:
image: mongo
ports:
-27017:27017
environment:
- MONGO-INITDB_ROOT_USERNAME=admin
- MONGO-INITDB_ROOT_PASSWORD=password
mongo-express:
image: mongo-express
ports:
-8080:8081
environment:
-ME_CONFIG_MONGODB_ADMINUSERNAME=admin
-ME_CONFIG_MONGODB_ADMINPASSWORD=password
-ME_CONFIG_MONGODB_SERVER=mongodb
I tried to search if there is a problem with the compatibility of the docker-compose & docker-engine but even though I tried to put other versions like 2/2.1/2.2/2.3/3/3.8 in the ".YAML" file I still get the same error message.
Docker Compose version v2.2.1 <br>
Docker Engine v20.10.11
Tried to look up some solutions but I was not able to find anything.
Your indentation is incorrect and some other spacing/syntax is also incorrect.
version: '3'
services:
mongodb:
image: mongo
ports:
- 27017:27017
environment:
- MONGO-INITDB_ROOT_USERNAME=admin
- MONGO-INITDB_ROOT_PASSWORD=password
mongo-express:
image: mongo-express
ports:
- 8080:8081
environment:
- ME_CONFIG_MONGODB_ADMINUSERNAME=admin
- ME_CONFIG_MONGODB_ADMINPASSWORD=password
- ME_CONFIG_MONGODB_SERVER=mongodb
I am trying to learn docker by reading the official documentation. I am on the task of Use Compose to develop locally. Trying to compose mongodb but I got an error
The Compose file './docker-compose.dev.yml' is invalid because:
Unsupported config option for services.volumes: 'mongodb'
here is docker-compose.dev.yml file:
version: '3.8'
services:
notes:
build:
context: .
ports:
- 8080:8080
- 9229:9229
environment:
- SERVER_PORT=8080
- DATABASE_CONNECTIONSTRING=mongodb://mongo:27017/notes
volumes:
- ./:/code
command: npm run debug
mongo:
image: mongo:4.2.8
ports:
- 27017:27017
volumes:
- mongodb:/data/db
- mongodb_config:/data/configdb
volumes:
mongodb:
mongodb_config:
How can I make it work?
That's a small mistake on your part, the volumes section of the docker-compose.yaml file is related to all services and not one in particular, because of how yaml files are formatted the indentation level matters a lot, in your example you didn't use the volumes parameter, instead you defined a service called volumes and services don't have a parameter called mongodb.
You have to simply decrease the identation level on the last 3 lines and it will work just fine.
version: '3.8'
services:
mongo:
image: mongo:4.2.8
ports:
- 27017:27017
volumes:
- mongodb:/data/db
- mongodb_config:/data/configdb
volumes:
mongodb:
mongodb_config:
In my Docker Instance, I created a volume called jokes. I'm trying to build out my service now with docker-compose up but I keep getting this error message:
ERROR: The Compose file './docker-compose.yml' is invalid because:
services.db.volumes contains an invalid type, it should be an array
Here is my docker-compose.yml file:
version: '3.6'
services:
web:
build: .
command: puma
depends_on:
- db
environment:
DATABASE_URL: "postgres://postgres#db"
ports:
- "3000:3000"
volumes:
- "./:/app"
working_dir: /app
db:
image: "postgres:10.3-alpine"
volumes: "-jokes: /var/lib/postgresql/data"
volumes:
jokes: ~
How should I fix this?
How should I fix this?
As detailed in the official documentation you are required to give a list there (hence complaint about list), so move hyphen outside the quotes like so:
volumes:
- "jokes:/var/lib/postgresql/data"
Hi I have been trying to make my following docker(based on moodle) compose file work
version: '2'
services:
mysql:
image: "mysql/mysql-server"
container_name: moodle-db
restart: always
env_file: .env
volumes:
- ./moodle-db:/var/lib/mysql:z
apache:
image: my-moodle-image:latest
container_name: moodle
restart: always
env_file: .env
ports:
- "8080:80"
depends_on:
- mysql
volumes:
- ./moodledata:/var/www/moodledata:z
#- ./themes:/var/www/theme
And it works as long as the commented line remains like that.
/var/www/theme has some files, but when mounting the folders goes empty instead of propagaiting the files to the file system.
can anyone point out, the why?
Thanks in advance
Tringing to base myself of https://docs.docker.com/engine/admin/volumes/#good-use-cases-for-tmpfs-mounts, in the following text:
If the container’s image contains data at the mount point, this data will be propagated into the bind mount or volume.