Unable to push Docker images to local registry, client times out - macos

I'm writing as I've encountered an issue that doesn't seem to get resolved, would value the community's help.
I'm trying to push an image to a local registry I deployed on port 5000.
When I use this command docker push localhost:5000/explorecalifornia.com to push the image to my local registry, I get the following message
Get "http://localhost:5000/v2/": net/http: request canceled (Client.Timeout exceeded while awaiting headers)
I've confirmed the registry is on port 5000 by using GET on postman, and I get a valid, expected {} response (since there's no images currently on my local registry).
I've since tried to fix this by updating my etc/hosts file to comment out "::1 localhost" per advise of this post. This is the contents of my etc/hosts file
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
# ::1 localhost
# Added by Docker Desktop
# To allow the same kube context to work on the host and the container:
127.0.0.1 kubernetes.docker.internal
# End of section
I also updated my etc/resolve.conf file with the following nameservers per advise from this post.
nameserver 10.0.2.3
nameserver 8.8.8.8
nameserver 8.8.4.4
None of this worked. Did anyone also encounter this issue? Is there any recommendations to help fix this issue?
Here's the source code if it helps! Thank you in advance :)

You may have a HTTP proxy defined. Please try running these commands.
unset http_proxy
unset https_proxy

I think there must be sth changed with the kind image. I use the script from this page:
https://kind.sigs.k8s.io/docs/user/local-registry/
I am able to create a new kind cluster and registry. After that, I have no problem following the video lecture to push the explorecalifornia.com image to the local registry.

I use a work-around for this error and it is as below:
Firstly, tag the images using the localhost ip instead, ie
docker tag imagename 127.0.0.1:5000/imagename
and,
docker push 127.0.0.1:5000/imagename
I hope this works for you as well.

Related

Cypress test not starting and throwing handshake error in console

I am trying to follow the getting started guide at https://docs.cypress.io/guides/getting-started/installing-cypress.html#System-requirements and when I run the following command
npx cypress open
it opens a popup and lists all the example specs. For now I am just running the example specs but this where I am facing the issue. It opens a browser but the page is just blank and I see the following error in the console,
Websocket connection to
'ws://localhost:62083/__socket.io/?EIO=3&transport=websocket' failed:
Connection closed before receiving a handshake response
I tested the same app in another machine and it works but its not working on my machine. Is there something that is causing the issue. My laptop is an office laptop is behind proxy. I checked the cypress proxy setting and I see that the proxy is correctly configured.
I had the same issue on my mac and this comment from filiphric solved the problem: https://github.com/cypress-io/cypress/issues/1239#issuecomment-419657694
open terminal, type: sudo nano /etc/hosts
if nothing is present, input defaults:
##
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
save and close. (ctrl + X then y then enter)
reopen cypress and all should work normally
Hope it can help you too!

MacOS doesn't resolve localhost to 127.0.0.1 (ignores hosts / apache vhosts)

I ran into the problem, that localhost redirects to a specific domain instead of 127.0.0.1.
My configuration is a local apache/mysql/php installation on MacOS Mojave using vhosts for different projects that are configured in hosts to redirect properly.
When I enter 127.0.0.1 in any browser, I get to my overview page lying in the www root. The same should happen, when I enter localhost in the browser, but instead it redirects to a domain of a project I was working on in the past. It happens also without network connection, so the configuration is on this machine.
My /etc/hosts file:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost project1.local project2.local
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
The first line seems to be ignored and localhost doesn't resolve to 127.0.0.1.
I only have two vhost configurations plus default configuration with no wrong redirection and also the httpd.conf lookes fine. I searched the whole machine with grep -lr "redirectiondomain.com" * without results. I tried with apache switched off with the same result and looked up the MacOS network settings but I can't find anything related to the wrong redirection neither any other solution on stackoverflow or google that solves my issue. Has anybody a clue how the wrong redirection of localhost could be set somewhere else?
Edit: My hostname in MacOS is set. I tried localhost without port, with :80 and :8080

Cannot clone git repo un EC2 iNSTANCE

I used the following command and tried to clone a repo but unfortunately the following error pops up. I cannot go further
ubuntu#ip-add-rr-ee-ss:~$ git clone https://github.com/repo/file.git
Cloning into 'file'...
fatal: unable to access 'https://github.com/repo/file.git/': Could not resolve host: github.com
Could not resolve host
This must be due to DNS issue on your EC2 instance (I can see that you're using Ubuntu here)
You can try to use curl to test the connection to that URL first
Check the DNS configuration: cat /etc/resolv.conf
If possible, you
should replace your current DNS setting with others DNS like google
(8.8.8.8 & 8.8.4.4)
Try to edit that file: vi /etc/resolv.conf
You
should insert/edit the following into:
nameserver 8.8.8.8
nameserver 8.8.4.4
Save the file by clicking [Esc] and type :wq
I fixed the problem once I added the following to my outbound connection for my group security setting:
Type: All traffic
Protocol: All
ip: 0.0.0.0/0
This also fixed my sudo yum install issues too.

Phpstorm + xdebug : Remote host is configured as "localhost" despite server host is probably not local

I was following this instruction to validate my debugger configuration on Web Server. I uses a remote server whose FTP connection has been tested, but I get this warning message saying
Remote host is configured as 'localhost' despite server host is probably not local
My first question is: what does "remote host" and "server host" refer to respectively?
I know remote host is the setting xdebug.remote_host, and according to the xdebug documentation, it is "the host where the debug client is running".
This makes me confused: Isn't the debug client the IDE I am running on my local machine?
If yes, then shouldn't "the host where the debug client is running" be my local machines's IP address? If yes again, should I configure xdebug.remote_host to be my IP?
I tried setting it to my IP, the warning message does't show but it doesn't feel right because later I tried it with a random IP the message also doesn't show.
Secondly, the xdebug documentation also says that this xdebug.remote_host setting will be ignored if xdebug.remote_connect_back is enabled." Although not quite sure what this setting does, I set it to be "On", as the picture shows:
I was hoping this will eliminate the warning message, but it is still there. So how do I get rid of this message?
In my case, I had several apache virtual hosts setup for different projects. I was able to access projects via different urls, like : http://projectname1, http://anotherproject2 .
I was getting that same error in PhpStorm while doing xdebug validation:
Remote host is configured as “localhost” despite server host is
probably not local
Problem was fixed, once in php.ini xdebug.remote_host matched the URL of the project I was debugging. So, if I was debugging http://project1, I would have this in php.ini:
xdebug.remote_host="project1"
Having values as 127.0.0.1, or localhost didn't fix it.
Hope it helps someone.
Did you try with following?
xdebug.remote_host = "127.0.0.1"

multiple local domains with dnsmasq?

So I'm using dnsmasq for my local dev environment & I need to set it up to use multiple domains ex. (.dev, .test, .somethingelse) how can this be done?
currently It's working with .dev only
this is how my dnsmasq.conf looks like
address=/dev/127.0.0.1
listen-address=127.0.0.1
For every (sub)domain you want to server locally, add the following entry to your dnsmasq.conf:
address=/.domain/127.0.0.1
Now let your OS know, that you want to redirect requests to this domain to your local dnsmasq nameserver. Do this by creating a file "domain" in "/etc/resolvers".
/etc/resolvers/domain has the following content:
nameserver 127.0.0.1
More info about the resolver thing.
A more generic answer would be to have in /etc/dnsmasq.conf
local=/mylan/
and in /etc/hosts
192.168.1.3 dev dev.mylan
192.168.1.3 test test.mylan
192.168.1.4 build build.mylan
as per https://serverfault.com/questions/136332/setting-up-dnsmasq-for-a-local-network
(note that the solution comes in aid for the DHCP settings where you cannot have 2 hosts on the same IP, as the OP liked)
for me, address=/.aaa.com/.bbb.com/127.0.0.1 do the trick.
.dev is not recommended to be used in development as Google actually owns that top level domain.
You might want to use reserved TLDs, like .localhost, for development.
Good article about the same problem: https://web.archive.org/web/20180722223228/https://iyware.com/dont-use-dev-for-development/
In your /usr/local/etc/dnsmasq.conf add:
address=/dev/test/127.0.0.1
And then create files:
/etc/resolver/dev and /etc/resolver/test. Both with content:
nameserver 127.0.0.1
From now all xyz.dev and xyz.test domains will point to 127.0.0.1.

Resources