docker-compose: Unsupported config option for services.db: 'jupyter' - docker

I am trying to learn how to utilize docker-compose and was following instructions until I received an error. Here's my docker-compose file.
version: '3'
services:
db:
image: postgres:11.2-alpine
volumes:
- ./pgdata:/var/lib/postgresql/data
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRESS_PASSWORD=${POSTGRESS_PASSWORD}
jupyter:
images: jupyter/scipy-notebook:17aba6048f44
volume:
- ./:/home/notebook
ports:
- "8888:8888"
When I go back and enter "docker-compose up -d --build", I would get an error saying
The Compose file './docker-compose.yml' is invalid because:
Unsupported config option for services.db: 'jupyter'
My docker-compose version is 1.23.2 and trying to run this on Mac. Any ideas? thanks in advance.
I'm sorry, I'm not good at English, so I'm referring to this question.

Edit it like below
version: '3'
services:
db:
image: postgres:11.2-alpine
volumes:
- ./pgdata:/var/lib/postgresql/data
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRESS_PASSWORD=${POSTGRESS_PASSWORD}
jupyter:
image: jupyter/scipy-notebook:17aba6048f44
volumes:
- ./:/home/notebook
ports:
- "8888:8888"

version: '3'
services:
db:
image: postgres:11.2-alpine
volumes:
- ./pgdata:/var/lib/postgresql/data
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRESS_PASSWORD=${POSTGRESS_PASSWORD}
jupyter:
image: jupyter/scipy-notebook:65761486d5d3
volumes:
- ./:/home/notebook
ports:
- "8888:8888"

version: '3'
services:
db:
image: postgres:11.2-alpine
volumes:
- ./pgdata:/var/lib/postgresql/data
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRESS_PASSWORD=${POSTGRESS_PASSWORD}
jupyter:
image: jupyter/scipy-notebook:17aba6048f44 # you write "images" but actually it should be image
volume:
- ./:/home/notebook
ports:
- "8888:8888"

Related

OSError: Function not implemented - Odoo Docker - command: ["odoo","--dev","xml,reload"]

version: '3.4'
services:
db:
image: postgres:13
ports:
- "5432:5432"
environment:
- POSTGRES_DB=postgres
- POSTGRES_PASSWORD=odoo
- POSTGRES_USER=odoo
- PGDATA=/var/lib/postgresql/data/db-files/
volumes:
- ./data/db:/var/lib/postgresql/data
odoo:
build: .
depends_on:
- db
ports:
- "8069:8069"
volumes:
- ./extra-addons:/mnt/custom-addons
- ./data/odoo:/var/lib/odoo
command: ["odoo","--dev","xml,reload"]
This is my docker-compose.yml file
When I use Ubuntu, it works. But when I use MacOS, it doesn't work. The problem is command: ["odoo","--dev","xml,reload"]. When I comment it, I can run on MacOS
Please help me fix it

Invalid docker.compose.yaml file

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'

services.mysql Additional property website is not allowed

version: '3.8'
volumes:
datafiles:
services:
mysql:
image: mysql:latest
command: --default-authentication-plugin=mysql_native_password
container_name: mysql_ecommerce
environment:
- MYSQL_ROOT_PASSWORD=12345
- MYSQL_TCP_PORT=3308:3306
volumes:
- datafiles:/var/lib/mysql
restart: always
website:
container_name: web_ecommerce
build:
context: .
dockerfile: Dockerfile
enviroment:
- MYSQL_DBHOST=mysql
- MYSQL_DBPORT=3306
- MYSQL_DBUSER=root
- MYSQL_DBPASS=12345
- MYSQL_DBNAME=
ports:
- 8082:80
- 8083:443
depends_on:
- mysql
You may need to check your docker-compose file and ensure it follows the correct indentation.
version: '3.8'
services:
mysql:
website:

docker-compose volumes: ./var:/var error?

docker-compose.yml:
version: '3'
services:
mysql56:
image: mysql:5.6
container_name: mysql56
volumes:
# - ./mysql:/var/lib/mysql
- ./var:/var
ports:
- 3307:3306
- 33060:33060
environment:
TZ: Asia/Shanghai
MYSQL_ROOT_PASSWORD: 'root#123'
networks:
- shanhy-ci
networks:
shanhy-ci:
driver: bridge
run:
docker-compose up
It outputs error:
Creating mysql56 ... error
...
merged/var/lib: file exists\\\"\"": unknown
ERROR: Encountered errors while bringing up the project.
But if I modify docker-compose.yml:
volumes:
- ./mysql:/var/lib/mysql
# - ./var:/var
So he can work normally, I don't know why,
Why does docker have/var/lib/mysql, but does not have /var?
image: mysql:5.6 : https://github.com/docker-library/mysql/blob/4ee6cf34697d33b2f71144ef55f96867b71220d5/5.6/Dockerfile

ERROR: In file './docker-compose.yml', service name True must be a quoted string, i.e. 'True'

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

Resources