Port Address already in use: bind - jenkins

Facing issues with Jenkins
With every restart I need to start Jenkins with some unique Port.
With every new launch I have to use cmd like:java -jar jenkins.war --httpPort=8081(new port everytime)
Note:I tried killing pid ports used earlier like 8080,8090,8081.
Please suggest how to resolve this on Windows.
Please help,how can we use the same ports again?

Related

Xdebug inside Colima docker container doesn't connect to PhpStorm debugger on Mac

I am trying to use Colima to run an apache-php docker container. My uni provides docker images derived from upstream ones configured for our course using docker-compose.
The container works as it should but I can't get its Xdebug to connect to my PhpStorm.
This is what it says in the Xdebug log:
Creating socket for 'host.docker.internal:9003', poll success, but error: Operation now in progress (29).
This tells me absolutely nothing.
The setup is admittedly quite complex (x86 Apache ran via QEMU in Docker in Linux VM in macOS on ARM CPU) but I can do nc host.docker.internal 9003 from any docker container, so I have no idea why Xdebug isn't able to reach my host. (Only works when the IDE is running and on no other ports, so it's definitely connecting to PhpStorm.)
Any idea what could be going on here?
On Colina, the IP address is hard coded to "192.168.5.2", so setting xdebug.client_host=192.168.5.2 should do the trick. There is now also an alias for it, called host.lima.internal.
As per this documentation page.
The problem is the uni's docker-compose.yml which configured the container with:
extra_hosts:
- "host.docker.internal:host-gateway"
and apparently that can break host.docker.internal in some situations: https://github.com/docker/for-linux/issues/264#issuecomment-759737542
The solution is to remove those two lines.

Change Jenkins port

I am trying to change the Jenkins port from default 8080 to port 80.
so I modified the file /etc/sysconfig/jenkins and changed the variable JENKINS_PORT="8080" to JENKINS_PORT="80".
after changing the port I restarted jenkins service by systemctl restart jenkins and the service status was Active: active (exited).
I changed the port back to 8080 and after restart the service status was Active: active (running)which is good, I also tried to change the port to 8081 and the service status was Active: active (running) as well, just when I am trying to use port 80 the service status is Active: active (exited).
I tried to verify if port 80 is in use using netstat -pnltu | grep -i "80"
and the port not in use, I tried to configure port 83 just for testing and I get the same behavior as port 80 configured (Active: active (exited))
Am I missing something here?
There is another solution for Linux systems that mentioned in Jenkins Documentation here
If Jenkins fails to start because a port is in use, run:
systemctl edit jenkins
and add the following:
[Service]
Environment="JENKINS_PORT=8081"
This will change the port from 8080 to 8081.
You can do it in below way:
1. Go to the directory where you installed Jenkins (by default, it's under Program Files/Jenkins)
2. Open the Jenkins.xml configuration file.
3. You can find --httpPort=8080 and replace the 8080 with the new port number.
Restart your Jenkins server.
$ jenkins.exe restart
You can also refer How to configure Jenkins to run on port 80
I found a solution,
I changed the JENKINS_USER variable value from jenkins to root on /etc/sysconfig/jenkins.
Then I restarted Jenkins service using the command:
systemctl restart jenkins
and the service is running.
Ports 0-1024 are reserved for the operating system and core services - services running as root.
Sounds like you are following the Jenkins install instructions which suggest creating a jenkins user and group - this is why you can run the app on 8080 and others greater than 1024.
Depending on your OS, edit your jenkins.service file and change these settings there.
On Centos, edit /usr/lib/systemd/system/jenkins.service or systemctl edit jenkins to make modifications to these settings. Better practice would be to use systemctl edit.. when editing systemd files.
To change Default Port of Jenkins in Windows while using jenkins.war use httpPort, I have created a small Video.

Worldserver changing ports after docker-compose down & docker-compose up

I'm using AzerothCore with Docker.
I've noticed that after running docker-compose down and docker-compose up my worldserver and the database now uses different ports than the defaults. How to prevent this?
Note: the authserver port remained the same.
I use Windows 10 20H2 (Build 19042.844)
Normally docker creates automatically a tunnel on a random free port for any service that tries to bound on its own network.
However, unless you changed the WORLD_EXTERNAL_PORT or the port is already busy for some reason, the original port (together with the random one) should be open as well.
you can run the docker-compose ps or the docker ps to check which are network ports open.
Also, this behaviour changes based on your OS. Can you specify it in your first post, please?
thanks for the prompt reply, I haven't changed anything about WORLD_EXTERNAL_PORT, as for 'docker-compose ps' again my overwhelming inexperience comes out hehe, dont know where to enter the command, the 'docker ps' gives this result:

Allow bootp for dnsmasq in docker container

I try to run dnsmasq which have to provide DHCP + BOOTP,
but dnsmask doesn't open 67\udp port when it is running in container.
With similar configuration file on the host system it works properly.
I run container with flags -net host and -privileged, but it doesn't help me.
Why dnsmasq doesn't want to open 67/udp (BOOTP server) into container?
How I able to fix it for doing that?
the root cause isn't in docker configuration.
I missed to add configuration file /etc/dnsmasq.d/default.conf with required parameters.
After adding it 67 port was opened and exposing began works

Docker run connection timeout

While running
sudo docker pull centos
it gives connection time out, While it is running behind proxy where the proxy has been set http_proxy & https_proxy. What is the reason apart from proxy,though it seems proxy issue.I checked LINK but in vain, is there some other settings i am missing please let me know.
2014/11/10 23:31:53 Get https://index.docker.io/v1/repositories/centos/images: dial tcp 162.242.195.84:443: connection timed out
I was getting timeouts on Windows 10 Docker 17.03.0-ce-rc1
To fix it I opened Settings / Network and then set the DNS server to 8.8.8.8
If you are running behind proxy then,
add following command or line in /etc/default/docker file,
export http_proxy=<YOUR_PROXY>
Restart docker service and check,
# service docker restart
service docker stop
HTTP_PROXY=http://proxy_ip:port/ docker -d &
This should work.
On Ubuntu, you can add HTTP_PROXY and HTTPS_PROXY to /etc/default/docker
So yes, what worked for me at the end is setting the proxy, as mentioned by other answers.
I went to icon tray --> Right click on docker to windows --> Go to
settings --> set the proxy as ip:port
Please refer screenshot as below
To change for a fast, open and non-intrusive DNS on CentOS 7:
sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0
add the line:
PEERDNS=no
and
sudo vi /etc/resolv.conf
keep only the line:
nameserver 9.9.9.9
If you run into these docker pull timeout issues on Docker Toolbox running on Windows 10 Home and piggybacking off an existing Virtualbox installation, check to see if Virtualbox is separately open and if so, shut down running machines and close Virtualbox (one or more of those running machines within Virtualbox were created and are being leveraged by Docker Toolbox). This heavy-handed way of going about things worked for me
Generally the problem of connection timeout, I know why the internet output was restricted to download docker images from external repositories,
To check this you can try to download the image from another server or another machine with a different internet channel.
If you can send the image from scp use the command: sudo docker save -o /home/your_image.tar your_image_name. and use with this command sudo docker load -i your_image.tar

Resources