coturn docker container error Temporary failure in name resolution - docker

i am trying to run coturn in docker folowing this tutorial and using mongodb as a selected database
here is docker-compose of coturn with mongodb
docker-compose-mongodb.yml
version: "3"
services:
# MongoDB
mongodb:
image: mongo
restart: unless-stopped
container_name: docker-mongo
ports:
- "27017:27017"
volumes:
- mongodb-data:/data/db
env_file:
- mongodb/mongodb.env
networks:
- backend
# Coturn
coturn:
build:
context: ../
dockerfile: ./docker/coturn/debian/Dockerfile
restart: always
volumes:
- ./coturn/turnserver.conf:/etc/turnserver.conf:ro
- ./coturn/privkey.pem:/etc/ssl/private/privkey.pem:ro
- ./coturn/cert.pem:/etc/ssl/certs/cert.pem:ro
ports:
## STUN/TURN
- "3478:3478"
- "3478:3478/udp"
- "3479:3479"
- "3479:3479/udp"
- "80:80"
- "80:80/udp"
## STUN/TURN SSL
- "5349:5349"
- "5349:5349/udp"
- "5350:5350"
- "5350:5350/udp"
- "443:443"
- "443:443/udp"
# Relay Ports
# - "49152-65535:49152-65535"
# - "49152-65535:49152-65535/udp"
networks:
- frontend
- backend
depends_on:
- mongodb
env_file:
- coturn/coturn.env
# DB
- mongodb/mongodb.env
volumes:
mongodb-data:
networks:
frontend:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.16.238.0/24
backend:
internal: true
and here is the coturn (dockerFile)[https://github.com/coturn/coturn/blob/master/docker/coturn/debian/Dockerfile]
i am using the file as it is
now when i run
docker-compose -f docker-compose-mongodb.yml up
and here is
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
85eaa0b1d14e docker_coturn "docker-entrypoint.s…" 3 minutes ago Up 3 minutes 0.0.0.0:80->80/tcp, 0.0.0.0:80->80/udp, :::80->80/tcp, :::80->80/udp, 0.0.0.0:443->443/tcp, 0.0.0.0:443->443/udp, :::443->443/tcp, :::443->443/udp, 0.0.0.0:3478-3479->3478-3479/tcp, 0.0.0.0:3478-3479->3478-3479/udp, :::3478-3479->3478-3479/tcp, :::3478-3479->3478-3479/udp, 0.0.0.0:5349-5350->5349-5350/tcp, 0.0.0.0:5349-5350->5349-5350/udp, :::5349-5350->5349-5350/tcp, :::5349-5350->5349-5350/udp docker_coturn_1
4226a039f1ea mongo "docker-entrypoint.s…" 3 minutes ago Up 3 minutes docker-mongo
when i try to ping
nc -zvv docker-mongo 27017
i am getting
nc: getaddrinfo for host "docker-mongo" port 27017: Temporary failure in name resolution
and
nc -zvv docker_coturn_1 3478
and its also giving the same error
nc: getaddrinfo for host "docker_coturn_1" port 3478: Temporary failure in name resolution
how can i resolve this error ? i am using ubuntu 20.04 lts

Related

Cannot get Redis Cluster to run on Docker Compose

I'm trying to figure out how to run Redis cluster using Docker Compose.
However, I'm getting the following error:
Error response from daemon: Ports are not available: exposing port TCP 0.0.0.0:6380 -> 0.0.0.0:0: listen tcp 0.0.0.0:6380: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted.
version: '3.9'
services:
dynamodb-local:
container_name: dynamodb-local
image: amazon/dynamodb-local:latest
command: -jar DynamoDBLocal.jar -sharedDb -dbPath ./data
ports:
- 8000:8000
volumes:
- ./docker/dynamodb:/home/dynamodblocal/data
working_dir: /home/dynamodblocal
networks:
- webnet
redis-master: # Setting up master node
image: bitnami/redis:latest
ports:
- 6379:6379
environment:
- REDIS_REPLICATION_MODE=master
- REDIS_PASSWORD=my_master_password
volumes:
- ./docker/redis:/bitnami/redis/data # Redis master data volume
- ./docker/redis/conf/redis.conf:/opt/bitnami/redis/conf/redis.conf # Redis master configuration volume
networks:
- webnet
redis-replica:
image: bitnami/redis:latest
ports:
- 6380-6382:6379
depends_on:
- redis-master
environment:
- REDIS_REPLICATION_MODE=slave
- REDIS_MASTER_HOST=redis-master
- REDIS_MASTER_PORT_NUMBER=6379
- REDIS_MASTER_PASSWORD=my_master_password
- REDIS_PASSWORD=my_replica_password
deploy:
replicas: 3
networks:
- webnet
networks:
webnet:
driver: bridge

How to run tests from Docker in PhpStorm?

I configured PhpStorm for running tests from docker container in the IDE by clicking the Run button, but I got the following error when I run them:
Doctrine\DBAL\Exception\ConnectionException : An exception occurred in driver: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known
from .env:
database_host: sp_mysql
database_port: null
docker-compose:
version: "3.4"
services:
nginx:
container_name: sp_nginx
image: nginx
ports:
- 8080:80
volumes:
- ./docker/nginx/conf:/etc/nginx/conf.d/:ro
- ./var/log/nginx/:/var/log/nginx:cached
- ./web:/app/web
depends_on:
- php
networks:
- internal
php:
container_name: sp_php
image: sp/php
build:
context: ./
dockerfile: ./docker/php/Dockerfile
volumes:
- ./:/app
- ~/.ssh:/root/.ssh
depends_on:
- mysql
networks:
- internal
mysql:
container_name: sp_mysql
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: password
volumes:
- ./docker/mysql/conf:/etc/mysql/conf.d
- mysql_data:/var/lib/mysql
ports:
- 3308:3306
networks:
- internal
networks:
internal:
volumes:
mysql_data:
But if I go directly to php container it works:
docker exec -it sp_php vendor/bin/phpunit
i setup my ide Docker/PHPUnit config by this guide:
https://www.youtube.com/watch?v=I7aGWO6K3Ho&t=240s
To solve this problem i set this in .env
host: "172.19.0.1" // docker network bridge gateway
port: "3308" // my db port from docker-compose
https://docs.docker.com/network/network-tutorial-standalone/

How to setup Redis Commander and Docker?

I've tried the 'with docker' docs here but it's not working from the localhost:7000, localhost:8081, or any other port I use. What am I missing?
REDIS_PORT=6379
### Redis ################################################
redis:
container_name: redis
hostname: redis
build: ./redis
volumes:
- ${DATA_PATH_HOST}/redis:/data
ports:
- "${REDIS_PORT}:6379"
networks:
- backend
### REDISCOMMANDER ################################################
redis-commander:
container_name: rediscommander
hostname: redis-commander
image: rediscommander/redis-commander:latest
restart: always
environment:
- REDIS_HOSTS=local:redis:6379
ports:
- "7000:80"
networks:
- frontend
- backend
depends_on:
- redis
Docker ps gives me:
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
042c9a2e918a rediscommander/redis-commander:latest "/usr/bin/dumb-init …" About a minute ago Up About a minute (healthy) 8081/tcp, 0.0.0.0:7000->80/tcp rediscommander
86bc8c1ca5ff laradock_redis "docker-entrypoint.s…" About a minute ago Up About a minute 0.0.0.0:6379->6379/tcp redis
Docker logs rediscommander gives me:
$ docker logs rediscommander
Creating custom redis-commander config '/redis-commander/config/local-production.json'.
Parsing 1 REDIS_HOSTS into custom redis-commander config '/redis-commander/config/local-production.json'.
node ./bin/redis-commander
Using scan instead of keys
No Save: false
listening on 0.0.0.0:8081
access with browser at http://127.0.0.1:8081
Redis Connection redis:6379 using Redis DB #0
Redis commader is listening on port 8081 in container. That is why you should change port binding to
ports:
- "7000:8081"
in redis commander block and access it via localhost:7000.

nginx-proxy docker container crashes with exit code 2

Introduction
Hello folks!
It is great to have helpful and skillful members like you.
I am stuck after reproducing the step-by-step instructions from various blogs to create a whole suite of Docker-powered apps from a small hosted VPS.
Mainly to create a blog with ghost, nginx and ssl.
Problem
While executing docker-compose.yml the nginx container stops:
nginx-gen | 2018/04/09 07:52:03 Generated '/etc/nginx/conf.d/default.conf' from 5 containers
nginx-gen | 2018/04/09 07:52:03 Sending container 'nginx' signal '1'
nginx-gen | 2018/04/09 07:52:03 Watching docker events
nginx | nginx-gen | 2018/04/09 07:52:03 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification ''
nginx-gen | 2018/04/09 07:52:03 Received event die for container 789c0544cf96
nginx-gen | 2018/04/09 07:52:03 Debounce minTimer fired
nginx exited with code 2
Setup
GCP CE g1-small (1 vCPU, 1,7 GB Memory)
Ubuntu 16.04.4 LTS
Docker version 18.03.0-ce, build 0520e24
docker-compose version 1.20.1, build 5d8c71b
Docker Images
jwilder/nginx-proxy
jwilder/docker-gen
jrcs/letsencrypt-nginx-proxy-companion
Files #
nginx.tmpl (Source: https://github.com/jwilder/nginx-proxy/blob/master/nginx.tmpl)
docker-compose.yml
Notes
All files are in the same folder.
Used already docker network create nginx-proxy
docker-compose.yml
version: '2'
services:
nginx:
image: jwilder/nginx-proxy
container_name: nginx
ports:
- '80:80'
- '443:443'
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- /etc/nginx/conf.d
- /etc/nginx/vhost.d # to update vhost configuration
- /usr/share/nginx/html # to write challenge files
- "../../../volumes/proxy/certs:/etc/nginx/certs:ro"
networks:
- default
nginx-gen:
image: jwilder/docker-gen
container_name: nginx-gen
volumes:
- "/var/run/docker.sock:/tmp/docker.sock:ro"
- "./:/etc/docker-gen/templates/:ro"
volumes_from:
- nginx
entrypoint: /usr/local/bin/docker-gen -notify-sighup nginx -watch -wait -5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf
ssl-companion:
image: jrcs/letsencrypt-nginx-proxy-companion
container_name: ssl-companion
volumes_from:
- nginx
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "../../../volumes/proxy/certs:/etc/nginx/certs:rw"
mariadb:
image: 'bitnami/mariadb:latest'
volumes:
- '/mariadb_data:/bitnami:z'
environment:
- ALLOW_EMPTY_PASSWORD=yes
- MARIADB_USER=<USER_NAME> # change <USER_NAME>
- MARIADB_DATABASE=<DB_NAME> # change <DB_NAME>
blog:
image: 'bitnami/ghost:latest'
expose:
- '2368'
depends_on:
- mariadb
environment:
- VIRTUAL_HOST=<YOUR_VR_HOST> # change <YOUR_VR_HOST>
- LETSENCRYPT_HOST=<YOUR_LC_HOST> # change <YOUR_LC_HOST>
- LETSENCRYPT_EMAIL=<YOUR_EMAIL> # change <YOUR_EMAIL>
- GHOST_DATABASE_USER=<USER_NAME> # change <USER_NAME>
- GHOST_DATABASE_NAME=<DB_NAME> # change <DB_NAME>
- GHOST_HOST=localhost
- MARIADB_HOST=mariadb
- MARIADB_PORT_NUMBER=3306
- ALLOW_EMPTY_PASSWORD=yes
volumes:
- '/ghost_data:/bitnami:z'
restart: unless-stopped
networks:
- default
networks:
default:
external:
name: nginx-proxy

Docker error connecting to host mysql

Docker version 17.03.1-ce, build c6d412e
OS: Ubuntu
I am trying to connect to host mysql from the docker container. but i am getting this error.
Error: connect ECONNREFUSED 0.0.0.0:3306
I am getting same for mysql if i use mysql container. Tried 127.0.0.1 and localhost also.
version: '2'
services:
### Applications Code Container
#############################
applications:
image: tianon/true
volumes:
- ${APPLICATION}:/var/www/html
apache2:
build:
context: ./apache2
volumes_from:
- applications
volumes:
- ${APACHE_HOST_LOG_PATH}:/var/log/apache2
- ./apache2/sites:/etc/apache2/sites-available
ports:
- "${APACHE_HOST_HTTP_PORT}:80"
- "${APACHE_HOST_HTTPS_PORT}:443"
networks:
- frontend
- backend
node:
build:
context: ./node
volumes_from:
- applications
ports:
- "4000:30001"
networks:
- frontend
- backend
### MySQL Container #########################################
mysql:
build:
context: ./mysql
environment:
- MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_USER=${MYSQL_USER}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
volumes_from:
- applications
volumes:
- ${DATA_SAVE_PATH}/mysql:/var/lib/mysql
- ./mysql/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
ports:
- "${MYSQL_PORT}:3306"
networks:
- backend
### Networks Setup ############################################
networks:
frontend:
driver: "bridge"
backend:
driver: "bridge"
### Volumes Setup #############################################
volumes:
mysql:
driver: "local"
mongo:
driver: "local"
node:
driver: "local"
apache2:
driver: "local"
Instead of using 0.0.0.0, 127.0.0.1 or localhost, you should use your host machine's IP. This is because each container is a individual node in the network.
Or if you can inspect your MySQL container, and get the IP of it, you can use the IP as well, since they are on the same network.

Resources