Recv failure when I use docker-compose for set up redisDB - redis

sorry but I'm new to redis and dockers and I'm getting stuck.
I want to connect redis to my localhost with docker-compose. When I use docker-compose my web and my redis shows that they are ON but when i try to make curl -L http://localhost:8081/ping for test it I get this message "curl: (56) Recv failure:"
I tryed to change my docker-compose.yaml but is not working
docker-compose:
version: '3'
services:
redis:
image: "redis:latest"
ports:
- "6379:6379"
web:
build: .
ports:
- "8081:6379"
environment:
REDIS_HOST: 0.0.0.0
REDIS_PORT: 6379
REDIS_PASSWORD: ""
depends_on:
- redis
Dockerfile
FROM python:3-onbuild
COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt
CMD ["python", "main.py"]
My expected results are this:
curl -L http://localhost:8081/ping
pong
curl -L http://localhost:8081/redis-status
{"redis_connectivity": "OK"}

Related

How to configure Jaeger agent to send traces to collector on another server

I'm trying to use Jaeger to manage tracing system. Docker is running locally "all-in-one" image with application (on the same host) without any issues. My question is how to configure jaeger agent on host1 that would send traces jaeger collector on another host2. Host2 is configured with "all-in-one". I can see Jaeger UI on host2 but it doesn't seem getting any traces from host1.
Configure tracer:
var configuration = new Configuration("service-name")
.withSampler(Configuration.SamplerConfiguration.fromEnv())
.withReporter(Configuration.ReporterConfiguration.fromEnv());
GlobalTracer.registerIfAbsent(configuration.getTracer());
return openTracer;
Added environment variables in yaml file on host1:
-e JAEGER_AGENT_HOST=jaeger.hostname.com \
-e JAEGER_AGENT_PORT=6831 \
Added jaeger image in yaml file on host2:
$ docker run -d --name jaeger \
-p 5775:5775/udp \
-p 6831:6831/udp \
-p 6832:6832/udp \
-p 5778:5778 \
-p 16686:16686 \
-p 14268:14268 \
-p 9411:9411 \
jaegertracing/all-in-one:latest
Any suggestions will be appreciated.
In my case.
Host2
version: '2'
services:
hotrod:
image: jaegertracing/example-hotrod:1.28
ports:
- '8080:8080'
- '8083:8083'
command: ["-m","prometheus","all"]
environment:
- JAEGER_AGENT_HOST=jaeger-agent
- JAEGER_AGENT_PORT=6831
- JAEGER_SAMPLER_TYPE=remote
- JAEGER_SAMPLING_ENDPOINT=http://jaeger-agent:5778/sampling
depends_on:
- jaeger-agent
jaeger-collector:
image: jaegertracing/jaeger-collector:1.28
command:
- "--cassandra.keyspace=jaeger_v1_dc1"
- "--cassandra.servers=cassandra"
- "--collector.zipkin.host-port=9411"
- "--sampling.initial-sampling-probability=.5"
- "--sampling.target-samples-per-second=.01"
environment:
- SAMPLING_CONFIG_TYPE=adaptive
ports:
- "14269:14269"
- "14268:14268"
- "14250:14250"
- "9411:9411"
restart: on-failure
depends_on:
- cassandra-schema
jaeger-query:
image: jaegertracing/jaeger-query:1.28
command: ["--cassandra.keyspace=jaeger_v1_dc1", "--cassandra.servers=cassandra"]
ports:
- "16686:16686"
- "16687"
restart: on-failure
depends_on:
- cassandra-schema
jaeger-agent:
image: jaegertracing/jaeger-agent:1.28
command: ["--reporter.grpc.host-port=jaeger-collector:14250"]
ports:
- "5775:5775/udp"
- "6831:6831/udp"
- "6832:6832/udp"
- "5778:5778"
restart: on-failure
depends_on:
- jaeger-collector
cassandra:
image: cassandra:4.0
cassandra-schema:
image: jaegertracing/jaeger-cassandra-schema:1.28
depends_on:
- cassandra
host1 is
version: '2'
services:
jaeger-agent:
image: jaegertracing/jaeger-agent:1.28
command: ["--reporter.grpc.host-port=host2:14250"]
ports:
- "5775:5775/udp"
- "6831:6831/udp"
- "6832:6832/udp"
- "5778:5778"
restart: on-failure
it works well for me

How to interact between multiple docker containers, eg ubuntu container with selenium hub container

I have the following three docker containers
1. Ubuntu Container with Mono that has selenium scripts(DLL)
2. Selenium Hub Container
3. Selenium Chrome Node Container
when I build the Docker Compose File, All three containers are up and running, the Ubuntu container exits after sometime without executing any tests.Any idea on how to implement this?
I am executing the tests in the Ubuntu container using mono and would like to create a docker image once this works. Any explanation or sample code on this would be really great.
I have created a bridge and have assigned static ip to all three containers.
Docker Compose File:
version: '3.7'
services:
seleniumhub:
image: selenium/hub
container_name: hubcontainer
networks:
ynetwork:
ipv4_address: 172.21.0.2
ports:
- "4444:4444"
privileged: true
nodechrome:
image: selenium/node-chrome-debug
container_name: chromecontainer
volumes:
- /dev/shm:/dev/shm
depends_on:
- seleniumhub
environment:
- HUB_HOST=seleniumhub
- HUB_PORT=4444
- NODE_MAX_INSTANCES=5
- NODE_MAX_SESSION=5
- START_XVFB=false
networks:
ynetwork:
ipv4_address: 172.21.0.10
Mytests:
container_name: Myubuntutests
depends_on:
- seleniumhub
- nodechrome
networks:
ynetwork:
ipv4_address: 172.21.0.11
build:
context: .
dockerfile: ubuntu.Dockerfile
networks:
ynetwork:
name: ytestsnetwork
driver: bridge
ipam:
config:
- subnet: 172.21.0.0/16
Docker File ubuntu.Dockerfile
FROM ubuntu
COPY /bin/Debug/ /MyTests
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Asia/Tokyo
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && apt-get update && apt-get clean && apt-get install -y wget && apt-get install -y curl && apt-get install -y nuget && apt-get install -y mono-complete && apt-get update && nuget update -self && nuget install testrunner
WORKDIR "/MyTests"
ENTRYPOINT mono /TestRunner.1.8.0/tools/testrunner.exe MyTests.dll
Docker Compose commands used (tried):
docker-compose up --build
docker-compose up --build -d
I expect the Docker Compose to Build all three containers and execute the tests and exit once done

Docker : image build failed

when building docker apache image, the building fail in this step :
Step n/m : COPY httpd-foreground /usr/local/bin/
ERROR: Service 'apache' failed to build: COPY failed: stat
/var/lib/docker/tmp/docker-builder511740141/httpd-foreground: no such
file or directory
this is my docker_compose.yml file
version: '3'
services:
mysql:
image: mysql:5.7
container_name: mysql_octopus_dev
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: app
MYSQL_USER: root
MYSQL_PASSWORD: root
apache:
build: .
container_name: apache_octopus_dev
volumes:
- .:/var/www/html/
ports:
- "8000:80"
depends_on:
- mysql
this is my docker file
FROM debian:jessie-backports
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
#RUN groupadd -r www-data && useradd -r --create-home -g www-data www-data
...
COPY httpd-foreground /usr/local/bin/
EXPOSE 80
CMD ["httpd-foreground"]
any help please?
Paths in a Dockerfile are always relative to the the context directory. The context directory is the positional argument passed to docker build (often .).
I should place the httpd-foreground file in the same folder of dockerfile.
From : https://github.com/docker/for-linux/issues/90

AMC for the aerospike server running inside docker

I have run the aerospike server inside docker container using below command.
$ docker run -d -p 3000:3000 -p 3001:3001 -p 3002:3002 -p 3003:3003 -p 8081:8081 --name aerospike aerospike/aerospike-server
89b29f48c6bce29045ea0d9b033cd152956af6d7d76a9f8ec650067350cbc906
It is running succesfully. I verified it using the below command.
$ docker ps
CONTAINER ID IMAGE COMMAND
CREATED STATUS PORTS
NAMES
89b29f48c6bc aerospike/aerospike-server "/entrypoint.sh asd"
About a minute ago Up About a minute 0.0.0.0:3000-3003->3000-3003/tcp, 0.0.0.0:8081->8081/tcp aerospike
I'm able to successfully connect it with aql.
$ aql
Aerospike Query Client
Version 3.13.0.1
C Client Version 4.1.6
Copyright 2012-2016 Aerospike. All rights reserved.
aql>
But when I launch the AMC for aerospike server in docker, it is hanging and it is not displaying any data. I've attached the screenshot.
Did I miss any configuration. Why it is not loading any data?
You can try the following:
version: "3.9"
services:
aerospike:
image: "aerospike:ce-6.0.0.1"
environment:
NAMESPACE: testns
ports:
- "3000:3000"
- "3001:3001"
- "3002:3002"
amc:
image: "aerospike/amc"
links:
- "aerospike:aerospike"
ports:
- "8081:8081"
Then go to http://localhost:8081 and enter in the connect window "aerospike:3000"

How do you set up selenium grid using docker on windows?

Steps I have taken already
1. Downloaded and installed Docker Toolbox for windows
2. Open Docker Quickstart terminal
3. Entered the below commands to pull the docker images from dockerhub and run them
docker pull selenium/hub
docker pull selenium/node-chrome
docker pull selenium/node-firefox
docker run -d -P \--name hub selenium/hub
docker run -d --link hub:hub -P \--name chrome selenium/node-chrome
docker run -d --link hub:hub -P \--name firefox selenium/node-firefox
It appears to be running when I type docker logs hub but I am unable to route my tests to the hub's address on the virtualbox VM using seleniumAddress in my conf.js file or see it using http://ipAddress:4444/grid/console .
Ideally I would like to use this set up to expand the amount of parallel test instances I can run.
Unfortunately the selenium docker image might be broken since 4 days ago but you can try my alternative one:
Pull the image and run as many containers as you need
docker pull elgalu/selenium
docker run -d --name=grid4 -p 4444:24444 -p 5904:25900 \
-v /dev/shm:/dev/shm -e VNC_PASSWORD=hola elgalu/selenium
docker run -d --name=grid5 -p 4445:24444 -p 5905:25900 \
-v /dev/shm:/dev/shm -e VNC_PASSWORD=hola elgalu/selenium
docker run -d --name=grid6 -p 4446:24444 -p 5906:25900 \
-v /dev/shm:/dev/shm -e VNC_PASSWORD=hola elgalu/selenium
Wait until the all the grids started properly before starting the tests (Optional but recommended)
docker exec grid4 wait_all_done 30s
docker exec grid5 wait_all_done 30s
docker exec grid6 wait_all_done 30s
After this, Selenium should be up and running at http://localhost:4444/wd/hub. Open the url in your browser to confirm it is running.
If you are using Mac (OSX) or Microsoft Windows localhost won't work! Find out the correct IP through boot2docker ip or docker-machine ip default.
So set the selenium port accordingly for each of your test:
1st test should connect to http://ipAddress:4444/wd/hub
2nd test to http://ipAddress:4445/wd/hub
3rd test to http://ipAddress:4446/wd/hub
You can run as many as your hardware can take.
Take a look at the Protractor Cookbook w/ Docker. The instructions are listed step-by-step using selenium-grid and docker compose. Docker-selenium issue #208 has been fixed.
So you'll need to pull down the latest images*:
docker pull selenium/hub:latest
docker pull selenium/node-chrome-debug:latest
Start the selenium grid:
docker run -d -p 4444:4444 --name selenium-hub selenium/hub:latest
Then add selenium nodes. I like to use the chrome-debug and firefox-debug versions to VNC to watch the tests.
docker run -d -p <port>:5900 --link selenium-hub:hub selenium/node-chrome-debug:latest
After linking your selenium grid, this should be enough to run your Protractor test using the seleniumAddress: 'http://localhost:4444/wd/hub'.
For debugging, find the VNC port for the container with:
docker port <container-name or container-id> 5900
and access it via VNC Viewer.
Note:
At the time of this writing, 'latest' appears to be tied to a ~2.53.1 version of selenium server. As of Protractor 4.0.11 (the latest version of Protractor), this is the supported version that should be used. Note that the instructions on the Selenium-docker GitHub appear to be for tailored for selenium server 3.0.1.
You can use below compose file to setup grid and access via VNC
**# To execute this docker-compose yml file use docker-compose -f up
**# Add the "-d" flag at the end for deattached execution****
version: '2'
services:
firefoxnode:
image: selenium/node-firefox-debug
volumes:
- /dev/shm:/dev/shm
depends_on:
- hub
environment:
HUB_HOST: hub
ports:
- "32772:5900"
chromenode:
image: selenium/node-chrome-debug
volumes:
- /dev/shm:/dev/shm
depends_on:
- hub
environment:
HUB_HOST: hub
ports:
- "32773:5900"
hub:
image: selenium/hub
ports:
- "4444:4444"
command I use:
docker-compose -f .\docker-compose.yml up -d
Source :
https://github.com/SeleniumHQ/docker-selenium