reportportal.io port to 8080 - docker

Im new to docker and reportportal.io and when i do the following command below.
sudo docker-compose -p reportportal up -d --force-recreate
Its trying to create a containter for port 8080 which is being used by jenkins. I received no error at all on my mint machine.
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
678d7741cbc4 reportportal/service-analyzer:4.3.0 "/service-analyzer" 50 seconds ago Up 37 seconds 8080/tcp
So what i did is change anything in the yml file that has 8080 to 8083 but still its using that port. How do i get around this?

you need to change only gateway exposed port
- "8080:8080" # HTTP exposed
change it like
- "8080:9090" # HTTP exposed
see codeline here:
https://github.com/reportportal/reportportal/blob/master/docker-compose.yml#L69

Looks like you are not doing the port mapping correctly inside the docker-compose.yml file. Please share the docker-compose file.

It is helpful if share docker file.
Try to run it like this docker-compose -p 8080:8083 -d --force-recreate
refer the following here

Related

Permanently change the tomcat port from Dockerfile

I want to run two containers inside a k8s pod.
tomcat exporter ( which runs on port 8080 )
tomcat application ( which also runs on the port 8080 )
As multiple running containers inside a pod cant share a same port , I am looking forward to build a custom tomcat image with a different port ( say 9090 ( default tomcat port is : 8080 ))
This is what the Dockerfile I have used.
cat Dockerfile
FROM tomcat:9.0.34
RUN sed -i 's/8080/9090/' /usr/local/tomcat/conf/server.xml
EXPOSE 9090
After building that image and running a container, I see that 9090 port has been assigned , but I also see 8080 is also still existing.
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b66e1e9c3db8 chakilams3/tomcatchangedport:v1 "catalina.sh run" 3 seconds ago Up 2 seconds 8080/tcp, 0.0.0.0:9090->9090/tcp test
I am wondering from where does this 8080/tcp port comes from , even after I have changed all refferences of 8080 to 9090 in the server.xml file
Any thoughts are appreciated.
With lots of effort, I found the solution to change the internal port of tomcat
container
my Dockerfile is
FROM tomcat:7.0.107
RUN sed -i 's/port="8080"/port="4287"/' ${CATALINA_HOME}/conf/server.xml
ADD ./tomcat-cas/war/ ${CATALINA_HOME}/webapps/
CMD ["catalina.sh", "run"]
Here
ADD ./tomcat-cas/war/ ${CATALINA_HOME}/webapps/ part is not necessary unless you want to initially deploy some war files. And also I don't add EXPOSE 4287, because if I did so, the tomcat server not binding to the port 4287 then it always binding to the 8080 default port.
Just build the image and run
docker build -f Dockerfile -t test/tomcat-test:1.0 .
docker run -d -p 4287:4287 --name tomcat-test test/tomcat-test:1.0
Checking the tomcat:9.0.34 Dockerfile in Dockerhub, we can see that it is exposing port 8080. What happens when you use this image as your parent image, is that you inherit this EXPOSE instruction from that image.
Searching through the documentation, there does not seem to exist an "unexpose" instruction in the Dockerfile to undo the EXPOSE 8080 instruction of the parent image.
This should not cause any issue, but if you would like to eliminate it, you could fork the tomcat Dockerfile, remove the EXPOSE instruction and build your own tomcat image.

What is the difference between docker run -p and ports in docker-compose.yml?

I would like to use a standard way of running my docker containers. I have have been keeping a docker_run.sh file, but docker-compose.yml looks like a better choice. This seems to work great until I try to access my website running in the container. The ports don't seem to be set up correctly.
Using the following docker_run.sh, I can access the website at localhost. I expected the following docker-compose.yml file to have the same results when I use the docker-compose run web command.
docker_run.sh
docker build -t web .
docker run -it -v /home/<user>/git/www:/var/www -p 80:80/tcp -p 443:443/tcp -p 3316:3306/tcp web
docker-compose.yml
version: '3'
services:
web:
image: web
build: .
ports:
- "80:80"
- "443:443"
- "3316:3306"
volumes:
- "../www:/var/www"
Further analysis
The ports are reported as the same in docker ps and docker-compose ps. Note: these were not up at the same time.
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
<id> web "/usr/local/scripts/…" About an hour ago Up About an hour 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp, 0.0.0.0:3307->3306/tcp <name>
$ docker-compose ps
Name Command State Ports
---------------------------------------------------------------------------------------------------------------
web /usr/local/scripts/start_s ... Up 0.0.0.0:3316->3306/tcp, 0.0.0.0:443->443/tcp, 0.0.0.0:80->80/tcp
What am I missing?
As #richyen suggests in a comment, you want docker-compose up instead of docker-compose run.
docker-compose run...
Runs a one-time command against a service.
That is, it's intended to run something like a debugging shell or a migration script, in the overall environment specified by the docker-compose.yml file, but not the standard command specified in the Dockerfile (or the override in the YAML file).
Critically to your question,
...docker-compose run [...] does not create any of the ports specified in the service configuration. This prevents port collisions with already-open ports. If you do want the service’s ports to be created and mapped to the host, specify the --service-ports flag.
Beyond that, the docker run command you show and the docker-compose.yml file should be essentially equivalent.
You don't run docker-compose.yamls the same way that you would run a local docker image that you have either installed or created on your machine. docker-compose files are typically launched running the command docker-compose up -d to run in detached mode. Then when you run docker ps you should see it running. You can also run docker-compose ps as you did above.

Traefik config file location using docker

Traefik's Getting Started guid is difficult to follow in any step by step fashion. It has the following problems:
Getting Started suggests running traefik as a command, but no commands can be run on the traefik image and you must instead use traefik:alpine, even to shell into the container with docker exec -it ....
Getting Started makes hardly any mention of a traefik.toml file.
#1 makes a new reader confused as to weather traefik is intended to be run as a container that automatically updates per newly deployed containers like jwilder's nginx proxy or if it's intended to be run on a docker host.
Their original docker-compose.yml file looks like this:
version: '3'
services:
reverse-proxy:
image: traefik # The official Traefik docker image
command: --api --docker #--consul --consul.endpoint=127.0.0.1:8500 # Enables the web UI and tells Traefik to listen to docker
ports:
- "80:80" # The HTTP port
- "8080:8080" # The Web UI (enabled by --api)
volumes:
- /var/run/docker.sock:/var/run/docker.sock # So that Traefik can listen to the Docker events
whoami:
image: containous/whoami # A container that exposes an API to show its IP address
labels:
- "traefik.frontend.rule=Host:whoami.docker.localhost"
Then you can run it with:
docker-compose up -d reverse-proxy
This is fine and you can add new services here and specify new labels like the one above, i.e. traefik.frontend.rule=Host:whoami-other.docker.localhost.
You can test this with curl, specifying the host heading like so:
curl -H Host:whoami.docker.localhost http://127.0.0.1
Issue 1)
Line 5 must be changed to use the image traefik:alpine.
image: traefik:alpine # The official Traefik docker image
You can now actually docker exec this container. You can only use sh (not /bin/bash) on the alpine image. We can now do the following:
docker exec -it traefik_reverse-proxy_1 sh
docker exec -it traefik_reverse-proxy_1 traefik --help
Issue 2)
From the default docker-compose.yml, there is no mention of a traefik.toml file. Even if I docker-compose up -d [some_new_service] and can reach those services, shelling into the container has no traefik.toml file. It's nowhere in the container, despite that per the bottom of Basics, it says looks for it default locations such as /etc/traefik/ and $HOME/.traefik/ and . or the working directory. Is this referring to the host or the container? In the container I run grep find and only see the binary:
/ # find / | grep traefik
/usr/local/bin/traefik
Is traefik storing my services configuration in memory?
The next logical page in the documentation (Basics), immediately starts detailing configuration of the traefik.toml, but I have to such file to experiment with.
I had to to back to Getting Started read at the bottom of that page to find that using a static traefik.toml file must be specified in a volume when they suggest using their official image and running like this:
docker run -d -p 8080:8080 -p 80:80 -v $PWD/traefik.toml:/etc/traefik/traefik.toml traefik
So with this, I change the volumes section in the original docker-compose.yml under the service reverse-proxy to use something similar:
volumes:
- /var/run/docker.sock:/var/run/docker.sock # So that Traefik can listen to the Docker events
- $PWD/traefik.toml:/etc/traefik/traefik.toml
Even with this, I don't have a base traefik.toml file to even use (there isn't even one in the examples folder of their GitHub). I had to go find one, but wasn't even sure how it would apply to the existing configuration of services I had running (i.e. whoami and/or whoami-other). Finally, running find / | grep traefik on the container shows the same traefik.toml file in /etc/traefik/traefik.toml, but it has no mention of the services (which I can still reach with curl -H Host:whoami.docker.localhost http://127.0.0.1 from my docker host). Where is the configuration then?
It is here
https://raw.githubusercontent.com/containous/traefik/v2.0/traefik.sample.toml
Somehow the traefik documents is confusing for newbie (I am).

Connect Kibana container with Elasticsearch

I've a VM which contains Docker and Elasticsearch (OS: Centos7). I would like to create a Kibana docker and connect with my ES.
The ES contains indices, if I type curl -s http://localhost:9200/_cat/indices I got the list of indices.
I used Dockerfile to create my Kibana image:
docker build -t="kibana_test" .
docker run --name kibana -e
ELASTICSEARCH_URL=http://#IP:9200 -e
XPACK_SECURITY_ENABLED=false -p 5600:5601 -d kibana_test
Well, if I put the address IP of my machine, I got this :
plugin:elasticsearch#6.2.4 Request Timeout after 3000ms
And in my Docker logs I got thi message:
License information from the X-Pack plugin could not be obtained from
Elasticsearch for the [data] cluster
How can I resolve this problem ?
Thanks for advance!
So, configure in elasticsearch.yml file.
network.host: 0.0.0.0
transport.host: localhost
transport.tcp.port: 9300
Then restart elasticsearh service first,
When build kibana container :
use this:
-e ELASTICSEARCH_URL=http://172.17.0.1:9200
check again.

How to properly register a volume location to a Docker container for PHP 7?

I am attempting to get a Docker container running PHP7, with a specific volume location and specific port 55211:80
When I add the following code to my docker-compose.yml file and compose up, the process is successful.
phpsandbox:
container_name: php_sandbox
restart: always
image: php:7
ports:
- "55211:80"
volumes:
- ./phpsandbox:/var/www/html/
I can see that my volume directory exists with my index.php inside...But if I then go to localhost:55211 in my browser, the browser says...
This page isn’t working localhost didn’t send any data.
What am I doing wrong in this part of my docker-compose.yml file?
UPDATE
From powershell, if I type in docker ps -a to see all running containers, php_sandbox is continosuly restarting, so I KNOW that something is wrong with this piece of code in my docker-compose.yml file, but don't know what...
Thanks!
The php:7 image only includes command line php tools. The image does not include a web server, so there is nothing on port 80 to respond to requests.
Try the php:7-apache image which comes with a preconfigured Apache httpd 2 web server that should work with your compose config.

Resources