In official pimcore document below docker-compose.yaml file is available but when i execute
following command. I am getting error.
ERROR: The Compose file './docker-compose.yaml' is invalid because:
Unsupported config option for services: 'nginx'
Unsupported config option for volumes: 'pimcore-database'
I checked all indentation. they are correct can anyone help below
Here is the official installation guide:
https://github.com/pimcore/demo
services:
redis:
image: redis:alpine
command: [ redis-server, --maxmemory 128mb, --maxmemory-policy volatile-lru, --save "" ]
db:
image: mariadb:10.7
working_dir: /application
command: [mysqld, --character-set-server=utf8mb4, --collation-server=utf8mb4_unicode_ci, --innodb-file-per-table=1]
volumes:
- pimcore-database:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=ROOT
- MYSQL_DATABASE=pimcore
- MYSQL_USER=pimcore
- MYSQL_PASSWORD=pimcore
nginx:
image: nginx:stable-alpine
ports:
- "8080:80"
volumes:
- .:/var/www/html:ro
- ./.docker/nginx.conf:/etc/nginx/conf.d/default.conf:ro
depends_on:
- php-fpm
- php-fpm-debug
php-fpm:
user: '1000:1000' # set to your uid:gid
image: pimcore/pimcore:PHP8.1-fpm
environment:
COMPOSER_HOME: /var/www/html
depends_on:
- db
volumes:
- .:/var/www/html
- pimcore-tmp-storage:/tmp
php-fpm-debug:
user: '1000:1000' # set to your uid:gid
image: pimcore/pimcore:PHP8.1-fpm-debug
depends_on:
- db
volumes:
- .:/var/www/html
- pimcore-tmp-storage:/tmp
environment:
PHP_IDE_CONFIG: serverName=localhost
COMPOSER_HOME: /var/www/html
supervisord:
user: '1000:1000' # set to your uid:gid
image: pimcore/pimcore:PHP8.1-supervisord
depends_on:
- db
volumes:
- .:/var/www/html
- ./.docker/supervisord.conf:/etc/supervisor/conf.d/pimcore.conf:ro
volumes:
pimcore-database:
pimcore-tmp-storage:
David Maze comment was on point. You must also consider to specify a supported version, because 3.8 is the last version right now, but maybe won't work in your case. For example, in my case (the docker-compose.yaml for the Pimcore demo project) the version is 3.3.
The solution that I found it was adding the version tag in the YML file:
version: '3'
services:
redis:
image: redis:alpine
command: [ redis-server, --maxmemory 128mb, --maxmemory-policy volatile-lru, --save "" ]
...
Related
I am trying to get a couple of containers up and running, however I am running into some issues. I run this command:
docker-compose up -d --build itvdflab
and get this error
The Compose file './docker-compose.yaml' is invalid because:
Unsupported config option for services: 'itvdelab'
Unsupported config option for networks: 'itvdelabnw'
Here is the yaml file.
services:
itvdelab:
image: itversity/itvdelab
hostname: itvdelab
ports:
- "8888:8888"
volumes:
- "./itversity-material:/home/itversity/itversity-material"
- "./data:/data"
environment:
SHELL: /bin/bash
networks:
- itvdelabnw
depends_on:
- "cluster_util_db"
cluster_util_db:
image: postgres:13
ports:
- "6432:5432"
volumes:
- ./cluster_util_db_scripts:/docker-entrypoint-initdb.d
networks:
- itvdelabnw
environment:
POSTGRES_PASSWORD: itversity
itvdflab:
build:
context: .
dockerfile: images/pythonsql/Dockerfile
hostname: itvdflab
ports:
- "8888:8888"
volumes:
- "./itversity-material:/home/itversity/itversity-material"
- "./data:/data"
environment:
SHELL: /bin/bash
networks:
- itvdelabnw
depends_on:
- "pg.itversity.com"
pg.itversity.com:
image: postgres:13
ports:
- "5432:5432"
networks:
- itvdelabnw
environment:
POSTGRES_PASSWORD: itversity
networks:
itvdelabnw:
name: itvdelabnw
What changes do I need to make to get this working?
Your docker-compose.yml file is missing a version: line. Until very recently, this caused Docker Compose to interpret this as the original "version 1" Compose format, which doesn't have a top-level services: key and doesn't support Docker networks. The much newer Compose Specification claims that a version: key is optional, but in practice if you can't be guaranteed to use a very new version of Compose (built as a plugin to the docker binary) it's required. The most recent Compose file versions supported by the standalone Python docker-compose tool are 3.8 and 2.4 (you need the 2.x version for some resource-related constraints in non-Swarm installations).
# Add at the very beginning
version: '3.8'
Here is the revised copy:
version: '3.4'
services:
itvdelab:
image: itversity/itvdelab
hostname: itvdelab
ports:
- "8888:8888"
volumes:
- "./itversity-material:/home/itversity/itversity-material"
- "./data:/data"
environment:
SHELL: /bin/bash
networks:
- itvdelabnw
depends_on:
- "cluster_util_db"
cluster_util_db:
image: postgres:13
ports:
- "6432:5432"
volumes:
- ./cluster_util_db_scripts:/docker-entrypoint-initdb.d
networks:
- itvdelabnw
environment:
POSTGRES_PASSWORD: itversity
itvdflab:
build:
context: .
dockerfile: images/pythonsql/Dockerfile
hostname: itvdflab
ports:
- "8888:8888"
volumes:
- "./itversity-material:/home/itversity/itversity-material"
- "./data:/data"
environment:
SHELL: /bin/bash
networks:
- itvdelabnw
depends_on:
- "pg.itversity.com"
pg.itversity.com:
image: postgres:13
ports:
- "5432:5432"
networks:
- itvdelabnw
environment:
POSTGRES_PASSWORD: itversity
networks:
itvdelabnw:
name: itvdelabnw
and now I get the following error
ERROR: The Compose file './docker-compose.yaml' is invalid because:
services.pg.itversity.com.networks.itvdelabnw contains unsupported option: 'name'
for me work try different version. In my case work
version: '2.2'
I have a docker-compose which looks like:
version: '3.2'
services:
jobsaf-server:
build:
context: ./application
dockerfile: Dockerfile.production
container_name: jobsaf-server
env_file:
- ./application/.env
tty: true
depends_on:
- "redis"
- "mongo"
links:
- mongo
- redis
volumes:
- ./application/server:/var/www/app/jobsaf-website/server
- ./application/public/assets:/var/www/app/jobsaf-website/public/assets
- ./application/uploads:/var/www/app/jobsaf-website/uploads
- ./application/sitemaps:/var/www/app/jobsaf-website/sitemaps
- ./application/rss:/var/www/app/jobsaf-website/rss
- "/etc/timezone:/etc/timezone:ro"
- "/etc/localtime:/etc/localtime:ro"
nginx:
image: nginx:stable
tty: true
env_file:
- ./.env
environment:
- NGINX_HOST=${APP_HOST}
- NGINX_PORT=${APP_PORT}
- PUID=1001
- PGID=1001
- TZ=Asia/Kabul
links:
- jobsaf-server
volumes:
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
- ./nginx/ssl/star_jobs_af.pem:/etc/ssl/star_jobs_af.pem
- ./nginx/ssl/jobs.af.key:/etc/ssl/jobs.af.key
- ./nginx/ssl/star_jobs_af.crt:/etc/ssl/star_jobs_af.crt
ports:
- "80:80"
- "443:443"
mongo:
image: mongo:latest
container_name: mongo
tty: true
env_file:
- ./.env
volumes:
- "db-data:/data/db"
environment:
- MONGO_INITDB_ROOT_USERNAME=${DB_USER}
- MONGO_INITDB_ROOT_PASSWORD=${DB_PASS}
- MONGO_INITDB_DATABASE=admin
ports:
- "0.0.0.0:27017:27017"
redis:
image: redis
container_name: redis
tty: true
volumes:
db-data:
# - /data/db
networks:
front-tier:
back-tier:
It build jobsaf-server:latest by default.
what I want is to keep the old tag and build the new one.
let say, while building the images I should pass something similar to this
docker-compose -f docker-compose.production --tag=1.0.1
the above command should build for me and image with tag jobsaf-server:1.0.1
Is it really possible to have such result?
Or is there any alternative solution for it
Thanks in advance.
Note: I want to keep the old image, in case if my new image has issue, then I can use the old image.
version: '3.2'
services:
jobsaf-server:
image: jobsaf-server:${TAG}
build:
context: ./application
dockerfile: Dockerfile.production
...
The best way to supply the tag is with a .env file like this:
TAG=1.0.1
Docker-compose will pick this up automatically.
From #Mihai suggestion following steps worked for me, incase if someone else needed.
version: '3.2'
services:
jobsaf-server:
image: jobsaf-server:${TAG}
build:
context: ./application
dockerfile: Dockerfile.production
To build:
Run TAG=1.0 docker-compose build it will create jobsaf-server:1.0
To Up:
Run TAG=1.0 docker-compose up -d
To down:
Run TAG=1.0 docker-compose down
Note: we can add TAG to .env file also by default.
My docker-compose.yml looks like the below. When i run docker-compose up I get the below error.
ERROR: In file './docker-compose.yml', the service name True must be a quoted string, i.e. 'True'.
version: '3'
services:
db:
restart: always
image: postgres:9.6-alpine
container_name: pleroma_postgres
networks:
- pleroma
volumes:
- ./postgres:/var/lib/postgresql/data
web:
build: .
image: pleroma
container_name: pleroma_web
restart: always
environment:
- VIRTUAL_HOST=<myplaceholderhost>
- VIRTUAL_PORT=4000
- LETSENCRYPT_HOST=<myplaceholderhost>
- LETENCRYPT_EMAIL=<myplaceholderemail>
expose:
- "4000"
volumes:
- ./uploads:/pleroma/uploads
depends_on:
- db
nginx:
image: jwilder/nginx-proxy
container_name: nginx
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- /apps/docker-articles/nginx/vhost.d:/etc/nginx/vhost.d
- /apps/docker-articles/nginx/certs:/etc/nginx/certs:ro
- /apps/docker-articles/nginx/html:/usr/share/nginx/html
restart: always
ports:
- "80:80"
- "443:443"
labels:
com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true"
networks:
- pleroma
letsencrypt:
image: jrcs/letsencrypt-nginx-proxy-companion:v1.5
container_name: letsencrypt
volumes_from:
- nginx
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- /apps/docker-articles/nginx/vhost.d:/etc/nginx/vhost.d
- /apps/docker/articles/nginx/certs:/etc/nginx/certs:rw
- /apps/docker-articles/nginx/html:/usr/share/nginx/html
networks:
pleroma:
My docker version is
Docker version 18.06.1-ce, build e68fc7a
My docker compose version is
docker-compose version 1.23.1, build b02f1306
Running CoreOS version 1911.3.0
I ended up resolving this issue by modifying the nginx and letsencrypt portions of my docker-compose.yml file to be as follows.
nginx:
image: jwilder/nginx-proxy
container_name: nginx
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- /apps/docker-articles/nginx/vhost.d:/etc/nginx/vhost.d
- /apps/docker-articles/nginx/certs:/etc/nginx/certs:ro
- /apps/docker-articles/nginx/html:/usr/share/nginx/html
restart: always
ports:
- "80:80"
- "443:443"
labels:
- "NGINX_PROXY_CONTAINER=true"
networks:
- pleroma
letsencrypt:
image: jrcs/letsencrypt-nginx-proxy-companion:v1.5
container_name: letsencrypt
environment:
- NGINX_PROXY_CONTAINER=true
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- /apps/docker-articles/nginx/vhost.d:/etc/nginx/vhost.d
- /apps/docker/articles/nginx/certs:/etc/nginx/certs:rw
- /apps/docker-articles/nginx/html:/usr/share/nginx/html
It seems "volumes_from" is deprecated in docker-compose v3. As well as I had forgotted quotes around my label and needed to set my environment within letsencrypt.
in CentOS env your .yml file directory must be /usr/local/bin
I have a yml file with a configuration to run two containers. Here's the file:
web:
build: ./web
ports:
- "8000:8000"
restart: always
volumes:
- website:/www/
nginx:
build: ./nginx
ports:
- "80:80"
restart: always
links:
- web
volumes:
- website:/www/
volumes:
website:
When I run this I always get the following error:
The Compose file '.\docker-compose.yml' is invalid because:
Unsupported config option for volumes: 'website'
I have googled this and I think this is good as it is now. What is wrong with it?
i think you should add version and services in docker-compose file.
version: '3'
services:
web:
build: ./web
ports:
- "8000:8000"
restart: always
volumes:
- website:/www/
nginx:
build: ./nginx
ports:
- "80:80"
restart: always
links:
- web
volumes:
- website:/www/
volumes:
website:
reference :
docker compose file
getting start with docker-compose
I'm trying to cap the max size of docker's log files. Each container's log file should max out at 100M. So each container such as the edge, worker, etc should only be allowed to have a log file that is 100MB.
I tried to insert:
log_opt:
max-size: 100m
At the end of my docker-compose.yml file below but i'm getting an error.
Where should I place it?. Also when I place it inside each container definition I'm getting an error. I read the docker docs but no where does it say where exactly to place the option.
This is my docker-compose.yml file:
version: '2.0'
services:
ubuntu:
image: ubuntu
volumes:
- box:/box
cache:
image: redis:3.0
rabbitmq:
image: rabbitmq:3-management
volumes:
- ${DATA}/rabbitmq:/var/lib/rabbitmq
ports:
- "15672:15672"
- "5672:5672"
placements-store:
image: redis:3.0
command: redis-server ${REDIS_OPTIONS}
ports:
- "6379:6379"
api:
image: ruby:2.3
command: bundle exec puma -C config/puma.rb
env_file:
- ./.env
working_dir: /app
volumes:
- .:/app/
- box:/box
expose:
- 3000
depends_on:
- cache
- placements-store
worker:
image: ruby:2.3
command: bundle exec sidekiq -C ./config/schedule.yml -q default -q high_priority,5 -c 10
env_file:
- ./.env
working_dir: /app
environment:
INSTANCE_TYPE: worker
volumes:
- .:/app/
- box:/box
depends_on:
- cache
- placements-store
sidekiq-monitor:
image: ruby:2.3
command: bundle exec thin start -R sidekiq.ru -p 9494
env_file:
- ./.env
working_dir: /app
volumes:
- .:/app/
- box:/box
depends_on:
- cache
expose:
- 9494
sneakers:
image: ruby:2.3
command: bundle exec rails sneakers:run
env_file:
- ./.env
working_dir: /app
environment:
INSTANCE_TYPE: worker
volumes:
- .:/app/
- box:/box
depends_on:
- cache
- placements-store
- rabbitmq
edge:
image: ruby:2.3
command: bundle exec thin start -R config.ru -p 3000
environment:
REDIS_URL: redis://placements-store
RACK_ENV: development
BUNDLE_PATH: /box
RABBITMQ_HOST: rabbitmq
working_dir: /app
volumes:
- ./edge:/app/
- box:/box
depends_on:
- placements-store
- rabbitmq
expose:
- 3000
proxy:
image: openresty/openresty:latest-xenial
ports:
- "80:80"
- "443:443"
volumes:
- ./config/nginx.conf:/usr/local/openresty/nginx/conf/nginx.conf
volumes:
box:
# node_modules:
# bower_components:
# client_dist:
This is what I tried, for example inserting under the rabbitmq container:
version: '2.0'
services:
ubuntu:
image: ubuntu
volumes:
- box:/box
cache:
image: redis:3.0
rabbitmq:
image: rabbitmq:3-management
#volumes:
# - ${DATA}/rabbitmq:/var/lib/rabbitmq
ports:
- "15672:15672"
- "5672:5672"
log_opt:
max-size: 50m
placements-store:
image: redis:3.0
command: redis-server ${REDIS_OPTIONS}
ports:
- "6379:6379"
This is the error I get:
ERROR: The Compose file './docker-compose.yml' is invalid because:
Unsupported config option for services.rabbitmq: 'log_opt'
Tried to change log_opt: with options: and got the same error:
ERROR: The Compose file './docker-compose.yml' is invalid because:
Unsupported config option for services.rabbitmq: 'options'
Also the docker version is:
docker --version && docker-compose --version
Docker version 1.11.2, build b9f10c9/1.11.2
docker-compose version 1.9.0, build 2585387
UPDATE:
Tried using the logging option like the doc says (for version 2.0):
version: '2.0'
services:
ubuntu:
image: ubuntu
volumes:
- box:/box
cache:
image: redis:3.0
rabbitmq:
image: rabbitmq:3-management
#volumes:
# - ${DATA}/rabbitmq:/var/lib/rabbitmq
ports:
- "15672:15672"
- "5672:5672"
logging:
driver: "json-file"
options:
max-size: 100m
max-file: 1
placements-store:
image: redis:3.0
command: redis-server ${REDIS_OPTIONS}
ports:
- "6379:6379"
Getting the error:
ERROR: for rabbitmq Cannot create container for service rabbitmq:
json: cannot unmarshal number into Go value of type string ERROR:
Encountered errors while bringing up the project.