Docker Port fowarding is not working anymore - docker

I have mutiple Docker containers that I use on my machine for testing, etc.,all through port fowarding.
Strangely, for the last four days I have not been able to connect to any of them. I made some tests with application outside of containers, it appears I can still connect to them.
But for every application inside a container I get a "connection reset by peer error"
I might have messed up with dangling docker network interface before this happenned,
but this is my first time having that consequence and now my work is really impeded.
Does anybody know what could be going on?

It was a problem with the iptables. I don't know which one, but after deleting them and reinstalling everything it started working again.

Related

Why does Docker randomly throw this a 'Permission Denied' error when trying to stop a container?

I am trying to stop a docker container and get the following error:
This happens randomly on occasion and it is very frustrating to have restart the docker service and relaunch all my containers.
Would anyone know what could be happening to cause this? As far I have seen or know, there has not been any changes made to the container since they have been launched, may some changes in the content of the data in the containers. Also if people need more information, I would be happy to provide.
FYI everything that I am doing I am doing as a root user.
ALSO -- ABSOLUTLEY CANNOT STOP THE DOCKER DAMON OR RESTART IT, THIS MUST BE RESOLVED WHILE KEEPING THE CURRENT CONTAINERS OPEN AND RUNNIN.

How can I debug Docker name resolution?

I have a very peculiar problem regarding Docker and how containers resolve the IP address of other containers using their container names.
My machine runs many different containers interacting with each other, making the problem difficult to reproduce in a minimal example as would be preferred if possible.
The problem I am encountering is that whenever I add a new container/service/docker-network (by running docker-compose up) all of a sudden, my container for reverse proxying HTTP(S) traffic starts resolving the IP addresses of containers incorrectly.
I can verify that the Name --> IP resolutions are incorrect by checking the logs of where the reverse proxy is trying to connect and then running docker network inspect on the container I expect it to resolve. These are now not the same, resulting in errors all around.
Whenever I stop the new service that triggered the errors, the name resolution is back to normal and all works as expected again. I have encountered this same problem when starting multiple different images, so the problem is most likely not in the new container.
Since I can not provide you with a simple minimally reproducible example (I would if I could), how can I further debug the docker name resolution in an attempt at gathering more information about this problem?
Any advice is appriceated. I know this is not the optimal Stack Overflow question, but I can't do much more without more information about my problem.
I hope you understand.

Access to internal infrastructure from Kubernetes

If I run Docker (Docker for Desktop, 2.0.0.3 on Windows 10), then access to internal infrastructure and containers is fine. I can easily do
docker pull internal.registry:5005/container:latest
But ones I enable Kubernetes there, I completely lose an access to internal infrastructure and [Errno 113] Host is unreachable in Kubernetes itself or connect: no route to host from Docker appears.
I have tried several ways, including switching of NAT from DockerNAT to Default Switch. That one doesn't work without restart and restart changes it back to DockerNAT, so, no luck here. This option also seems not to work.
let's start from the basics form the official documentation:
Please make sure you meet all the prerequisites and all other instructions were met.
Also you can use this guide. It has more info with details pointing to what might have gone wrong in your case.
If the above won't help, there are few other things to consider:
In case you are using a virtual machine, make sure that the IP you are referring to is the one of the docker-engines’ host and not the one on which the client is running.
Try to add tmpnginx in docker-compose.
Try to delete the pki directory in C:\programdata\DockerDesktop (first stop Docker, delete the dir and than start Docker). The directory will be recreated and k8s-app=kube-dns labels should work fine.
Please let me know if that helped.

Docker windows container DNS Cache and firewall

I have a Docker windows container and Linux container on a different node.
On windows, I opened ports in the firewall mentioned here: https://docs.docker.com/network/overlay/#operations-for-all-overlay-networks
(8 rules - 4 for in and 4 for out) but even then when I connect to the container on the windows host and try to ping the Linux container I receive "No such host is known" but after executing (inside the container):
Clear-DnsClientCache
everything starts to work.
I also removed the whole stack and tried to disable firewall and surprise - now everything works without clearing the DNS cache.
Once again I removed the stack and enabled the firewall - again I have to connect to the container and clear the cache to make it work.
Looks like there is something wrong in the firewall settings but what? I did not find any other ports which should be opened
Looks like I have just found an answer but I do not fully understand it. I have tried to open ports first 0-9999 then 0-5000 then 0-2500 etc and found out that I need to open port 1888 (tcp, in) to make the docker overlay network work immediately (I mean to be able to resolve services DNS names immediately) but I did not find anything about that on the internet. I have no idea why. Was I only one with that problem? Maybe this is not the correct solution? Could someone tell me why this port is needed and why Clear-DnsClientCache works even when 1888 is blocked?
Edit:
Looks like this solution was wrong. Now it just works once and then does not work and then once again works. I can remove and recreate the whole stack and it just works randomly.

Docker with Plesk: Random Container spawned

I played around with Docker and followed this Tutorial.
Using the docker functionality in Plesk, I pulled my created container from docker hub and ran it. When trying to remove it again, it threw an error message, which I didnt capture (didnt expected anything strange at that point). Then, when going back to the container overview it gave me the screen shown below.
Now, the container in the middle is mine (get-started), however, where the hell did angry_kare and peaceful_haibt come from?
Thank you guys for any answers or ideas! :)
(Im am currently not able to reproduce this :/)
Random containers spawned
When you run the container without a name. Docker will create containers with random names. The two containers which your having are the previously failed containers.

Resources