docker compose file is invalid ,additional properties not allowed tty - docker

I really need help on this error I don't understand why I get this error. Thanks
docker -v
Docker version 1.13.1, build 092cba3
docker-compose -v
docker-compose version 1.11.1, build 7c5d5e4
this is my dockerfile
version: '2.0'
services:
arcgis-server:
container_name: "arcgis-server"
image: "arcgis-server:10.4.1"
volumes:
- "./license:/license"
- "./arcgisserver:/arcgis/server/usr/directories"
- "./config-store:/arcgis/server/usr/config-store"
build:
context: .
dockerfile: "Dockerfile"
ulimits:
nproc: 25059
nofile:
soft: 65535
hard: 65535
ports:
- "127.0.0.1:6080:6080"
- "127.0.0.1:6443:6443"
- "4001:4001"
- "4002:4002"
- "4004:4004"
stdin_open: true
tty: true
here is the error
docker-compose build
ERROR: The Compose file './docker-compose.yml' is invalid because:
Additional properties are not allowed ('tty' was unexpected)
You might be seeing this error because you're using the wrong Compose file version. Either specify a supported version ("2.0", "2.1", "3.0") and place your service definitions under the `services` key, or omit the `version` key and place your service definitions at the root of the file to use version 1.
For more on the Compose file format versions, see https://docs.docker.com/compose/compose-file/
Actually I test on the old machine it worked fine. I would appreciate your helps. Thanks again!!!!

tty needs to be defined as a setting on your service, not at the top level. Yaml files are space sensitive, so removing the leading spaces puts the setting at the top level where it's not valid. Use the following syntax to fix it:
version: '2.0'
services:
arcgis-server:
container_name: "arcgis-server"
image: "arcgis-server:10.4.1"
volumes:
- "./license:/license"
- "./arcgisserver:/arcgis/server/usr/directories"
- "./config-store:/arcgis/server/usr/config-store"
build:
context: .
dockerfile: "Dockerfile"
ulimits:
nproc: 25059
nofile:
soft: 65535
hard: 65535
ports:
- "127.0.0.1:6080:6080"
- "127.0.0.1:6443:6443"
- "4001:4001"
- "4002:4002"
- "4004:4004"
stdin_open: true
tty: true

Related

Docker-compose file build context explanation

I am using a docker-compose file that is working but I have poor understanding of the file
In the following file how can I interpret
build:
context:
ulimits:
sysctl:
version: '3.1'
services:
zabbix-server:
container_name: zabbix-server
build:
context: zabbix-server-mysql
image: zabbix:ubuntu-5.4.4-custom
ulimits:
nproc: 65535
nofile:
soft: 20000
hard: 40000
sysctls:
- net.ipv4.ip_local_port_range=1024 65000
- net.ipv4.conf.all.accept_redirects=0
- net.ipv4.conf.all.secure_redirects=0
- net.ipv4.conf.all.send_redirects=0
build and context
ulimits 1 ulimits 2
sysctl 1 sysctl 2
and many many other articles

Docker ERROR: only one instance of "host" network is allowed [duplicate]

This question already has answers here:
How to run docker containers in host network mode using docker-compose?
(2 answers)
Closed 2 years ago.
I am trying to run a container where I need to user network driver as "host" instead of "bridge". I am running it on Centos machine and my docker-compose.yml is
version: '3.4'
services:
testContainer:
build:
context: .
args:
HADOOP_VERSION: 2.6.0
HIVE_VERSION: 1.1.0
image: testcontainer
container_name: testcontainer
hostname: testcontainer
ports:
- 9200:9200
- 9300:9300
- 5601:5601
- 9001:9001
ulimits:
memlock:
soft: -1
hard: -1
networks:
- elknet
networks:
elknet:
driver: host
But i am getting the following error when I fire "docker-compose up" :
ERROR: only one instance of "host" network is allowed
Can anyone please suggest how can I use host network using docker-compose.yml.
Also note that if I use network_host as suggested by #larsks, I am still getting error
version: '3.4'
services:
testContainer:
build:
context: .
args:
HADOOP_VERSION: 2.6.0
HIVE_VERSION: 1.1.0
image: testcontainer
container_name: testcontainer
hostname: testcontainer
ports:
- 9200:9200
- 9300:9300
- 5601:5601
- 9001:9001
ulimits:
memlock:
soft: -1
hard: -1
network_mode: host
I am getting following error
ERROR: The Compose file './docker-compose.yml' is invalid because:
Unsupported config option for services: 'testContainer'
Get rid of the networks section in your docker-compose.yml, and add a network_mode directive to your service definition:
services:
testContainer:
build:
context: .
args:
HADOOP_VERSION: 2.6.0
HIVE_VERSION: 1.1.0
image: testcontainer
container_name: testcontainer
hostname: testcontainer
ports:
- 9200:9200
- 9300:9300
- 5601:5601
- 9001:9001
ulimits:
memlock:
soft: -1
hard: -1
network_mode: host

Multiple docker-compose file with different context path

I have 2 docker-compose files that I need to run together, the locations of the files are like
/home/project1/docker-compose.yml
and
/home/project2/docker-compose.yml
so clearly both the services should have different contextpath
But when I run below docker compose command
docker-compose -f /home/project1/docker-compose.yml -f /home/project2/docker-compose.yml config
I get to see, Both the service are getting the same context path
app:
build:
context: /home/project1
dockerfile: Dockerfile
app2:
build:
context: /home/project1
dockerfile: Dockerfile
How can I resolve this issue I want both my services to have their own project path ie.
app service should have context path /home/project1
and
app2 service should have context path /home/project2
They way I found could run multiple services is:
1. First of all create images for all the services with the help of docker build command
ex: in my case it is a java application with maven build tool, so command I used:
mvn clean package docker:build -Denv=$ENV -DskipTests
2. After all the images built, create a common docker-compose file which will look like this
version: '3'
services:
service1:
image: <service1-image>
ports:
- "8100:8080"
environment:
- TZ=Asia/Kolkata
- MYSQL_USER=root
- MYSQL_PASSWORD=unroot
ulimits:
nproc: 65535
nofile:
soft: 65535
hard: 65535
service2:
image: <service2-image>
ports:
- "8101:8080"
environment:
- TZ=Asia/Kolkata
- MYSQL_USER=root
- MYSQL_PASSWORD=unroot
ulimits:
nproc: 65535
nofile:
soft: 65535
hard: 65535
service3:
image: <service3-image>
environment:
- TZ=Asia/Kolkata
- MYSQL_USER=root
- MYSQL_PASSWORD=unroot
ulimits:
nproc: 65535
nofile:
soft: 65535
hard: 65535
networks:
default:
external:
name: dev
The way I have mentioned mysql root, password, you can also add environment variables.
3.Then run below command to run all the services
docker-compose -f docker-compose.yml up
or run below command to run specific service
docker-compose -f docker-compose.yml up service1
This is working fine for me, this will require 1 time setup but after that it will be very easy and fast.
Option 1:
Use absolute paths for the contexts in both docker-compose files
Option 2:
Create a docker-compose.override.yml with the absolute paths:
version: "3"
services:
service1:
build:
context: /home/project1
service2:
build:
context: /home/project2
and include it in the docker-compose command:
docker-compose -f /home/project1/docker-compose.yml -f /home/project2/docker-compose.yml -f /home/docker-compose.override.yml config
On linux, to avoid hard-coding of the base path in the docker-compose.override.yml, you can use PWD environment variable:
services:
service1:
build:
context: ${PWD}/project1
service2:
build:
context: ${PWD}/project2
It seems that when using multiple docker-compose files the context is taken from the location of the first file. It is explained in detail in this issue
https://github.com/docker/compose/issues/3874

My docker can't come up anymore with elasticsearch

My docker container used to start successfully. As of this weekend it fails pulling elasticsearch. Please help (Windows 10 64bit)
> docker-compose up
Pulling elastic (elasticsearch:7.3.1)...
7.3.1: Pulling from library/elasticsearch
ERROR: no matching manifest for windows/amd64 10.0.17763 in the manifest list entries
> docker manifest inspect -v library/elasticsearch:latest
no such manifest: docker.io/library/elasticsearch:latest
Part of the docker-compose.yml
elastic:
image: elasticsearch:7.3.1
restart: always
environment:
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- xpack.security.enabled=false
- Elogger.level=TRACE
- discovery.type=single-node
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- esdata:/data/elasticsearch
ports:
- "9201:9200"
networks:
Can you check this post Docker: "no matching manifest for windows/amd64 in the manifest list entries"
Right click Docker icon in the Windows System Tray
Go to Settings
Daemon
Advanced
Set the "experimental": true
Restart Docker
no idea why you have library/elasticsearch:7.3.1 in your compose file.. according to official elasticsearch images the path is simply elasticsearch:7.3.1 - feel free to edit thet compose file and removelibrary/` part from image name

docker-compose up -d gives "OCI runtime create failed: wrong rlimit value" when trying to set mem_limit in the docker-compose.yml file

docker-compose version 1.18.0, build 8dd22a9 on Ubuntu 16.04
Docker version 17.12.0-ce, build c97c6d6
docker-compose file version: '3'
Relevant portion of the docker-compose file
elasticsearch1:
image: docker.elastic.co/elasticsearch/elasticsearch:5.6.0
container_name: elasticsearch1
restart: unless-stopped
environment:
- http.host=0.0.0.0
- reindex.remote.whitelist=remote_es:*
- xpack.security.enabled=false
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
mem_limit: 1000000000
volumes:
- esdata1:/usr/share/elasticsearch/data
ports:
- 9200:9200
When I do a docker-compose up -d, I get the following error:
ERROR: for elasticsearch1 Cannot start service elasticsearch1: OCI runtime create failed: wrong rlimit value: RLIMIT_MEM_LIMIT: unknown
Any ideas what's going on?
The docker-compose reference document seems to imply that since I've not running in swarm mode, I should be using the version 2 syntax for mem_limit even though my docker-compose file is version 3.
ERROR: for elasticsearch1 Cannot start service elasticsearch1: OCI runtime create failed: wrong rlimit value: RLIMIT_MEM_LIMIT: unknown
You got above error, because set mem_limit under the ulimits section. It should be under container level on the same level with image, environment etc:
elasticsearch1:
image: docker.elastic.co/elasticsearch/elasticsearch:5.6.0
container_name: elasticsearch1
restart: unless-stopped
environment:
- http.host=0.0.0.0
- reindex.remote.whitelist=remote_es:*
- xpack.security.enabled=false
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
mem_limit: 1000000000
volumes:
- esdata1:/usr/share/elasticsearch/data
ports:
- 9200:9200
And another issue is here. According to the issue:
The v3 format is specifically designed to run with Swarm mode and the
docker stack features. It wouldn't make sense for us to re-add options
to that format when they have been replaced and would be ignored in
Swarm mode.
It means that you can use cpu_shares, cpu_quota, cpuset, mem_limit, memswap_limit, mem_swappiness in version 2 only and use new resource options in version 3 in swarm mode only.
So, if you don't want to use swarm mode, you need to use version 2.
The final docker-compose.yml is:
version: '2'
services:
elasticsearch1:
image: docker.elastic.co/elasticsearch/elasticsearch:5.6.0
container_name: elasticsearch1
restart: unless-stopped
environment:
- http.host=0.0.0.0
- reindex.remote.whitelist=remote_es:*
- xpack.security.enabled=false
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
mem_limit: 1000000000
volumes:
- esdata1:/usr/share/elasticsearch/data
ports:
- 9200:9200

Resources