Change docker-compose.yml from linux version to windows - windows

I wrote docker-compose.yml, that worked fine in linux, but i have to port it on windows. The main problem is path, cause when i replace /<path> with c:/<path>, i get this error:
Error response from daemon: invalid mount config for type "volume":
invalid mount path: 'C://' mount path must be absolute
Here is the original code from linux:
docker-compose.yml
version: '2.5.1'
networks:
selenoid:
external:
name: selenoid
services:
selenoid:
networks:
selenoid: null
image: 'aerokube/selenoid:latest'
container_name: 'selenoid'
volumes:
- '/home/rolf/.aerokube/selenoid:/etc/selenoid'
- '/var/run/docker.sock:/var/run/docker.sock'
command: ['-conf', '/etc/selenoid/browsers.json', '-container-network', 'selenoid']
ports:
- '4444:4444'
mysql_db:
networks:
selenoid: null
image: 'percona:latest'
container_name: 'mysql_db'
environment:
MYSQL_ROOT_PASSWORD: admin
MYSQL_DATABASE: DB_MYAPP
MYSQL_USER: test_qa
MYSQL_PASSWORD: qa_test
ports:
- '3306:3306'
volumes:
- '/home/rolf/final_project/mysql/myapp_db:/docker-entrypoint-initdb.d'
healthcheck:
test: ['CMD', 'mysql', '-uroot', '-padmin', '-h0.0.0.0', '-P3306']
timeout: 2s
retries: 15
mock:
networks:
selenoid: null
image: 'vk_api:latest'
container_name: 'mock'
ports:
- '9000:9000'
healthcheck:
test: ['CMD', 'curl', '-f', 'http://0.0.0.0:9000/status']
timeout: 2s
retries: 15
myapp:
networks:
selenoid: null
image: 'myapp'
container_name: 'myapp'
ports:
- '9999:9999'
links:
- 'mock:mock'
- 'mysql_db:mysql_db'
volumes:
- /home/ilia/final_project:/config_dir
entrypoint: "/app/myapp --config=/config_dir/myapp.conf"
depends_on:
selenoid:
condition: service_started
mysql_db:
condition: service_healthy
mock:
condition: service_healthy
I tried to write -v //c/<path> like i saw in some stackoverflow questions, but that didn't work for me

Related

What is error syntax in my docker-compose.yml and how to fix?

I am using IntelliJ IDEA 2022.1.3 (Ultimate Edition).
My application.properties file
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/scheduler
spring.datasource.username=root
spring.datasource.password=123456a#
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.jpa.properties.hibernate.dialect= org.hibernate.dialect.MySQL8Dialect
# spring.jpa.database-platform=org.hibernate.dialect.MySQL8Dialect
# spring.jpa.database-platform=org.hibernate.dialect.MySQL8Dialect
# org.hibernate.dialect.MySQLInnoDBDialect
spring.batch.job.names=job
spring.batch.jdbc.initialize-schema=embedded
spring.batch.jdbc.isolation-level-for-create=default
spring.batch.jdbc.platform=mysql
spring.batch.jdbc.schema=classpath:/schema.sql
spring.batch.jdbc.table-prefix=
spring.batch.job.enabled=true
My file docker-compose.yml
version: "3.8"
services:
mysqldb:
image: mysql:latest
restart: unless-stopped
env_file: ./.env
environment:
- MYSQL_ROOT_PASSWORD=$MYSQLDB_ROOT_PASSWORD
- MYSQL_DATABASE=$MYSQLDB_DATABASE
ports:
- $MYSQLDB_LOCAL_PORT:$MYSQLDB_DOCKER_PORT
volumes:
- db:/var/lib/mysql
app:
depends_on:
- mysqldb
build: ./scheduler
restart: on-failure
env_file: ./.env
ports:
- $SPRING_LOCAL_PORT:$SPRING_DOCKER_PORT
environment:
SPRING_APPLICATION_JSON: '{
"spring.datasource.url" : "jdbc:mysql://mysqldb:$MYSQLDB_DOCKER_PORT/$MYSQLDB_DATABASE?useSSL=false",
"spring.datasource.username" : "$MYSQLDB_USER",
"spring.datasource.password" : "$MYSQLDB_ROOT_PASSWORD",
"spring.jpa.properties.hibernate.dialect" : "org.hibernate.dialect.MySQL8Dialect",
"spring.jpa.hibernate.ddl-auto" : "update"
}'
volumes:
- .m2:/root/.m2
stdin_open: true
tty: true
volumes:
db:
syntax error
How to fix these error?

ElasticSearch 7.10.1 with Docker reports java.net.UnknownHostException under Mac but not on Linux

Hi have the following docker-compose file with several services including ElasticSearch with two nodes:
version: '3'
services:
CO_MYSQL:
image: mysql:8.0.23
container_name: CO_MYSQL
environment:
MYSQL_ROOT_PASSWORD: 72EkBqCs!
volumes:
- /opt/cropontology/mysql/data:/var/lib/mysql
ports:
- 3306:3306
networks:
- CO_Network
CO_MONGO:
image: mongo:3.6.8
container_name: CO_MONGO
volumes:
- /opt/cropontology/mongo/data:/data/db
ports:
- 27017:27017
networks:
- CO_Network
CO_NEO4J:
image: neo4j:4.1.2
container_name: CO_NEO4J
volumes:
- /opt/cropontology/neo4j/data:/data
- /opt/cropontology/neo4j/plugins:/var/lib/neo4j/plugins
ports:
- 7474:7474
- 7687:7687
networks:
- CO_Network
CO_ES_01:
image: docker.elastic.co/elasticsearch/elasticsearch:7.10.1
container_name: CO_ES_01
environment:
- node.name=CO_ES_01
- cluster.name=es-docker-cluster
- discovery.seed_hosts=CO_ES_02
- cluster.initial_master_nodes=CO_ES_01,CO_ES_02
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- /opt/cropontology/es/data:/usr/share/elasticsearch/data
ports:
- 9200:9200
networks:
- CO_Network
CO_ES_02:
image: docker.elastic.co/elasticsearch/elasticsearch:7.10.1
container_name: CO_ES_02
environment:
- node.name=CO_ES_02
- cluster.name=es-docker-cluster
- discovery.seed_hosts=CO_ES_01
- cluster.initial_master_nodes=CO_ES_01,CO_ES_02
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- /opt/cropontology/es/data2:/usr/share/elasticsearch/data
networks:
- CO_Network
networks:
CO_Network:
driver: bridge
Everything works well under Linux but if I try to run the same file under Mac I get:
CO_ES_01 | "stacktrace": ["java.net.UnknownHostException: CO_ES_02",
Do I need specific configuration under Mac for it to work?

RASA: Sender_id always returned as “default”

I’m using docker-compose for deploying Rasa. I faced an issue when I tried to retrieve the sender_id in actions it always returned as “default”
Please find my docker-compose below:
version: "3.4"
x-database-credentials: &database-credentials
DB_HOST: "db"
DB_PORT: "5432"
DB_USER: "${DB_USER:-admin}"
DB_PASSWORD: "${DB_PASSWORD}"
DB_LOGIN_DB: "${DB_LOGIN_DB:-rasa}"
x-rabbitmq-credentials: &rabbitmq-credentials
RABBITMQ_HOST: "rabbit"
RABBITMQ_USERNAME: "user"
RABBITMQ_PASSWORD: ${RABBITMQ_PASSWORD}
x-redis-credentials: &redis-credentials
REDIS_HOST: "redis"
REDIS_PORT: "6379"
REDIS_PASSWORD: ${REDIS_PASSWORD}
REDIS_DB: "1"
x-duckling-credentials: &duckling-credentials
RASA_DUCKLING_HTTP_URL: "http://duckling:8000"
services:
rasa-production:
restart: always
image: "rasa/rasa:${RASA_VERSION}-full"
ports:
- "5006:5005"
volumes:
- ./:/app
command:
- run
- --cors
- "*"
environment:
<<: *database-credentials
<<: *redis-credentials
<<: *rabbitmq-credentials
DB_DATABASE: "${DB_DATABASE:-rasa}"
RABBITMQ_QUEUE: "rasa_production_events"
RASA_TELEMETRY_ENABLED: ${RASA_TELEMETRY_ENABLED:-true}
depends_on:
- app
- rabbit
- redis
- db
app:
restart: always
build: actions/.
volumes:
- ./actions:/app/actions
expose:
- "5055"
environment:
SERVICE_BASE_URL: "${SERVICE_BASE_URL}"
RASA_SDK_VERSION: "${RASA_SDK_VERSION}"
depends_on:
- redis
scheduler:
restart: always
build: scheduler/.
environment:
SERVICE_BASE_URL: "${SERVICE_BASE_URL}"
duckling:
restart: always
image: "rasa/duckling:0.1.6.3"
expose:
- "8000"
command: ["duckling-example-exe", "--no-access-log", "--no-error-log"]
# revers_proxy:
# image: nginx
# ports:
# - 80:80
# - 443:443
# volumes:
# - ./config/nginx/:/etc/nginx/conf.d/
# depends_on:
# - rasa-production
# - app
mongo:
image: mongo:4.2.0
ports:
- 27017:27017
# revers_proxy:
# image: nginx
# ports:
# - 5006:5006
# volumes:
# - ./config/nginx/defaul.conf:/etc/nginx/conf.d/default.conf
# depends_on:
# - rasa-production
# - app
redis:
restart: always
image: "bitnami/redis:6.0.8"
environment:
ALLOW_EMPTY_PASSWORD: "yes"
REDIS_PASSWORD: ${REDIS_PASSWORD}
expose:
- "6379"
redisapp:
restart: always
image: "bitnami/redis:6.0.8"
environment:
ALLOW_EMPTY_PASSWORD: "yes"
expose:
- "6379"
rabbit:
restart: always
image: "bitnami/rabbitmq:3.8.9"
environment:
RABBITMQ_HOST: "rabbit"
RABBITMQ_USERNAME: "user"
RABBITMQ_PASSWORD: ${RABBITMQ_PASSWORD}
RABBITMQ_DISK_FREE_LIMIT: "{mem_relative, 0.1}"
expose:
- "5672"
db:
restart: always
image: "bitnami/postgresql:11.9.0"
expose:
- "5432"
environment:
POSTGRESQL_USERNAME: "${DB_USER:-admin}"
POSTGRESQL_PASSWORD: "${DB_PASSWORD}"
POSTGRESQL_DATABASE: "${DB_DATABASE:-rasa}"
volumes:
- ./db:/bitnami/postgresql
endpoints.yml file
tracker_store:
type: sql
dialect: "postgresql"
url: ${DB_HOST}
port: ${DB_PORT}
username: ${DB_USER}
password: ${DB_PASSWORD}
db: ${DB_DATABASE}
login_db: ${DB_LOGIN_DB}
lock_store:
type: "redis"
url: ${REDIS_HOST}
port: ${REDIS_PORT}
password: ${REDIS_PASSWORD}
db: ${REDIS_DB}
event_broker:
type: "pika"
url: ${RABBITMQ_HOST}
username: ${RABBITMQ_USERNAME}
password: ${RABBITMQ_PASSWORD}
queue: rasa_production_events
Rasa Version : 2.1.0
Rasa SDK Version : 2.1.1
Rasa X Version : None
Python Version : 3.8.5
Operating System : Linux-5.4.0-48-generic-x86_64-with-glibc2.29
Python Path : /usr/bin/python3
Please any help to overcome this issue
Looks like a bug described in this issue https://github.com/RasaHQ/rasa/issues/7338

Laravel is not connecting to database on Docker/ docker-compose on Windows

I am working on a Laravel project using Docker. The following is my docker-compose.yml file that I use for the development environment.
version: '3'
services:
apache:
container_name: pathien_apache
image: webdevops/apache:ubuntu-16.04
environment:
WEB_DOCUMENT_ROOT: /var/www/public
WEB_ALIAS_DOMAIN: pathien.localhost
WEB_PHP_SOCKET: php-fpm:9000
volumes: # Only shared dirs to apache (to be served)
- ./public:/var/www/public:cached
- ./storage:/var/www/storage:cached
networks:
- pathien-network
ports:
- "8081:80"
- "443:443"
php-fpm:
container_name: pathien_php
image: jguyomard/laravel-php:7.3
volumes:
- ./:/var/www/
- ./ci:/var/www/ci:cached
- ./vendor:/var/www/vendor:delegated
- ./storage:/var/www/storage:delegated
- ./node_modules:/var/www/node_modules:cached
- ~/.ssh:/root/.ssh:cached
- ./composer.json:/var/www/composer.json
- ./composer.json:/var/www/composer.lock
- ~/.composer/cache:/root/.composer/cache:delegated
links:
- es01
networks:
- pathien-network
db:
container_name: pathien_db
image: mariadb:10.2
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: pathien
MYSQL_USER: pathien
MYSQL_PASSWORD: secret
volumes:
- pathien-data:/var/lib/mysql
networks:
- pathien-network
ports:
- "33060:3306"
es01:
image: docker.elastic.co/elasticsearch/elasticsearch:7.6.1
container_name: es01
environment:
- node.name=es01
- cluster.name=es-docker-cluster
- cluster.initial_master_nodes=es01
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- es-data:/usr/share/elasticsearch/data
ports:
- 9200:9200
networks:
- pathien-network
kibana:
image: docker.elastic.co/kibana/kibana:7.6.1
container_name: pathien_kibana
environment:
- ./kibana.yml:/usr/share/kibana/config/kibana.yml
ports:
- "5601:5601"
networks:
- pathien-network
networks:
pathien-network:
driver: "bridge"
volumes:
pathien-data:
driver: "local"
es-data:
driver: "local"
As you can see, I have a database image with the container name pathein_db. I am trying to connect it from the Laravel application setting the credentials in the .env file as follows.
DB_CONNECTION=mysql
DB_HOST=db
DB_PORT=3306
DB_DATABASE=pathein
DB_USERNAME=pathein
DB_PASSWORD=secret
Then I tried running the migration command
$ docker-compose exec php-fpm php artisan migrate
but got the following error:
Illuminate\Database\QueryException : SQLSTATE[HY000] [1045] Access denied for user 'pathein'#'172.21.0.6' (using password: YES) (SQL: SHOW FULL TABLES WHERE table_type = 'BASE TABLE')
at /var/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php:669
665| // If an exception occurs when attempting to run a query, we'll format the error
666| // message to include the bindings with SQL, which will make this exception a
667| // lot more helpful to the developer instead of just the database's errors.
668| catch (Exception $e) {
> 669| throw new QueryException(
670| $query, $this->prepareBindings($bindings), $e
671| );
672| }
673|
Exception trace:
1 PDOException::("SQLSTATE[HY000] [1045] Access denied for user 'pathein'#'172.21.0.6' (using password: YES)")
/var/www/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70
2 PDO::__construct("mysql:host=db;port=3306;dbname=pathein", "pathein", "secret", [])
/var/www/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70
Please use the argument -v to see more details.
This means that it is literally failing to connect to the database.
What is wrong with my configuration and how can I fix it?
You have spelled pathien wrong.
in your docker-compose.yml you have:-
MYSQL_DATABASE: pathien
MYSQL_USER: pathien
in your .env you have:
DB_DATABASE=pathein
DB_USERNAME=pathein

Failed to establish a new connection, Docker-Compose Django + Haystack + Mysql + ElasticSearch

When I enter on the url http://0.0.0.0:9200/ is working.
I am getting the following error when I want to save or retrieve data:
ConnectionError(<urllib3.connection.HTTPConnection object at
0x7f234afdacc0>: Failed to establish a new connection: [Errno 111]
Connection refused) caused by:
NewConnectionError(<urllib3.connection.HTTPConnection object at
0x7f234afdacc0>: Failed to establish a new connection: [Errno 111]
Connection refused)
My docker-compose.yml:
version: "2"
services:
redis:
image: redis:latest
rabbit:
image: rabbitmq:latest
ports:
- "5672:5672"
- "15672:15672"
mysql:
image: mysql:5.7.22
environment:
MYSQL_DATABASE: db
MYSQL_ROOT_PASSWORD: 'db'
ports:
- 3306
phpmyadmin:
image: nazarpc/phpmyadmin
environment:
MYSQL_USERNAME: db
ports:
- "0.0.0.0:8081:80"
links:
- mysql:mysql
celery_worker:
build:
context: .
command: bash -c "sleep 3 && celery -A wk worker -l debug"
volumes:
- /log:/log
- /tmp:/tmp
- ./wk:/wk
env_file:
- ./envs/development.env
environment:
- C_FORCE_ROOT=true
- BROKER_URL=amqp://guest:guest#rabbit//
working_dir: /wk
links:
- mysql:mysql
- rabbit:rabbit
- redis:redis
celery_worker_refactor:
build:
context: .
command: bash -c "sleep 10 && celery -A wk worker -l error -Ofair -Q refactor"
volumes:
- /log:/log
- /tmp:/tmp
- ./wk:/wk
env_file:
- ./envs/development.env
environment:
- C_FORCE_ROOT=true
- BROKER_URL=amqp://guest:guest#rabbit//
working_dir: /wk
links:
- mysql:mysql
- rabbit:rabbit
- redis:redis
celery_beat:
build:
context: .
command: bash -c "rm -f /tmp/celerybeat.pid && sleep 3 && celery -A wk beat -l debug -s /log/celerybeat --pidfile=/tmp/celerybeat.pid"
volumes:
- /log:/log
- /tmp:/tmp
- ./wk:/wk
env_file:
- ./envs/development.env
environment:
- C_FORCE_ROOT=true
- BROKER_URL=amqp://guest:guest#rabbit//
working_dir: /wk
links:
- mysql:mysql
- rabbit:rabbit
- redis:redis
ssh_server:
build:
context: .
dockerfile: Dockerfile-ssh
command: /usr/sbin/sshd -D
environment:
DEBUG: 'True'
env_file:
- ./envs/development.env
environment:
- BROKER_URL=amqp://guest:guest#rabbit//
volumes:
- ./wk:/wk
ports:
- "2222:22"
links:
- mysql:mysql
- redis:redis
- rabbit:rabbit
elasticsearch:
image: elasticsearch
environment:
- cluster.name=docker-cluster
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- xpack.security.enabled=false
volumes:
- esdata:/usr/share/elasticsearch/data
ports:
- "9200:9200"
- "9300:9300"
kibana:
image: kibana
ports:
- 5601:5601
web:
build:
context: .
command: bash -c "sleep 3 && python manage.py runserver 0.0.0.0:8000"
privileged: true
env_file:
- ./envs/development.env
environment:
- BROKER_URL=amqp://guest:guest#rabbit//
volumes:
- /log:/log
- /tmp:/tmp
- ./wk:/wk
depends_on:
- elasticsearch
links:
- mysql:mysql
- redis:redis
- rabbit:rabbit
- elasticsearch:elasticsearch
ports:
- "0.0.0.0:8000:8000"
volumes:
esdata:
driver: local
I tried to create e network between web and elastic search, same result.
When I call http://0.0.0.0:9200/ I get a response from server with a JSON.
My Haystack config in settings.py
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE':'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',
'URL': '0.0.0.0:9200/',
'INDEX_NAME': 'haystack'
}
}
HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.RealtimeSignalProcessor'
Some content so I can post this question, Is not only code.
You should use elasticsearch instead of 0.0.0.0:
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE':'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',
>>> 'URL': 'elasticsearch:9200',
'INDEX_NAME': 'haystack'
}
}

Resources