docker machine: getsockopt no route to host - docker

I set up docker private registry with Nexus 3.0.2 OSS on windows 2012 server as below,
docker_repository
there is a docker machines (version 0.8.0) installed on VirtualBox through Docker tools (v1.12.0) for windows (windows 8.1). I added the repository connector url to insecureRegistry in config.json file to allow insecure connection. It always returns "no route to host" error when trying to login to the Nexus docker registry. but it gets responds if using curl to test the connector.
Could someone please advise me how to fix it up as I am a novice to docker?
docker_registry

Related

Unable to pull any image from Docker public repository

I am unable to pull any image from the Docker public repository.
Until yesterday, everything was OK.
Nothing had changed in my network configuration.
No VPN, no proxy, working at home - connection at 540 Mbps according to fast.com.
I am using docker engine on Ubuntu 22.04 running inside WSL
Host Operating System:
Windows 11 Professionnal - Version 22H2 - Build 22621.819
$ docker -v
Docker version 20.10.19, build d85ef84
I have tried:
changed the default DNS to dns_google (8.8.8.8)
restarted the docker demon
restarted WSL
restarted the computer
connected to the internet on another network (4G)
flushed the DNS info locally (ipconfig /flushdns on Windows CMD)
searched for any reports of unavailability, change of rules on docker official site.
I was expecting the image to be downloaded to my local computer to be used by docker,
but I got this:
$ docker pull hello-world
Using default tag: latest
Error response from daemon:
Get "https://registry-1.docker.io/v2/": dial tcp: lookup registry-1.docker.io on <my_ip>:53: read udp <my_ip>:42896-><my_ip>:53: read: connection refused

Docker Not pulling images from the Docker Hub on Mac OS

After installing Docker Desktop on Mac OS,
I can run commands like docker ps.
But I can't run docker run hello-world or docker-compose up.
Here is the Error message!
Unable to find image 'docker/getting-started:latest' locally
docker: Error response from daemon: Get https://registry-1.docker.io/v2/: Service Unavailable.
See 'docker run --help'.**
I've tried
installing and uninstalling Docker Desktop
restarting my Mac OS
After trying different things, here is the answer for Mac OS users!
Run this command.
docker info | grep Proxy
You'll get the similar result like below.
HTTP Proxy: http.xxxx.xxxx:1278
HTTPS Proxy: http.xxxx.xxxx:1278
Go to the Docker Desktop setting >> Resources >> Proxies. Then, turn on manual proxy configuration.
Put your HTTP Proxy as above. http.xxxx.xxxx:1278
But put "s" in your HTTPS Proxy as https.xxxx.xxxx:1278
And then click "Apply&Restart". The problem is solved!

Failed to Docker login to JFrog Artifactory running in a Docker

I following the steps in section of Docker Installation" to get JFrog Artifactory (version 4.160 rev 40364) running in a Docker on Linux Mint fine and I able to access my instance JFrog Artifactory from Chrome browser at: http://SERVER_HOSTNAME:8082/ui/. Please see the URL
https://www.jfrog.com/confluence/display/JFROG/Installing+Artifactory#InstallingArtifactory-DockerInstallation
On my Virtual server running Linux where I Installed JFrog Artifactory and Docker
I have my host file to contains
docker-virtual.art.local docker-dev-local2.art.local docker-prod-local2.art.local
Also I created and edit /etc/default/docker file to contains
DOCKER_OPTS="$DOCKER_OPTS --insecure-registry docker-virtual.art.local --insecure-registry docker-dev-local2.art.local --insecure-registry docker-prod-local2.art.local --insecure-registry docker-remote.art.local"
My problem is when I tried to
docker login docker-virtual.art.local
or
docker push docker-virtual.art.local/hello-world
I get errors of
response from daemon: Get https://docker-virtual.art.local/v2/: Gateway Timeout
or
Get https://docker-virtual.art.local/v2/: Gateway Timeout
Can you please let know what I am doing wrong.
What I see here is that Artifactory is installed as a Docker container which means that this Artifactory's conatainer's IP is different from the localhost(Linux server). I assume that the host file is edited for the localhost and not for the container's IP. Make sure that the container's IP can be accessed over the Linux server which should be accessible and then change the host file accordingly. Provided this Gateway timeout happens when there is no response from the server and client times out and I believe that the IPs play a significant role here since Artifactory is running as docker container.

Accessing website hosted in a linux container from windows host

I have a linux container based on latest ruby image hosted in my windows laptop. I have a sample website running in the container. I can confirm that the website is running fine because running curl http://localhost:4000 with in the container returns the expected html. However, when I try to access the url from a browser in Windows it fails saying that it is not reachable. I am trying to figure out a way to access the sample app using browser in Windows.
Though I am trying to setup a ruby container (as I am trying to learn ruby), I am suspecting this is a networking problem with LCOW because I cannot ping the ip address of the container from Windows command prompt. It gives the error that "TTL expired in transit". Has anyone ever successfully tried a linux container on windows and accessing the website hosted in the container from windows? Could you please help me in figuring out what I am doing wrong or if I have to do something extra, like network route configuration, to make this working?
Further Details:
Docker version: 19.03.4
Host: Windows 10 Business Edition
Base Image: ruby on linux
docker run command used:
docker run -dit -p 4000:4000 --rm --name test updatedRubyImage
updatedRubyImage: This is a new image I created using base image. I installed a few gems on top of the base and commited it as a new image.

How to configure dynamically provisioned Docker agents

I installed Docker on Windows 10, and I pulled jenkins docker from Docker Hub. Next, I started my jenkins docker,
docker run --rm -u root -p 8080:8080 -v my_host_path:/var/jenkins_home jenkins
Next, I used Manage Jenkins and Manage Plugins to install Docker plugin, then went to the Configure page and tried to add Docker Cloud.
After I entered Docker Host URI : tcp://127.0.0.1:2375, I wanted to "Test Connection", but unfortunately got failed.
I tried to follow the instruction as below link:
How to find "Docker Host URI" to be used in Jenkins "Docker Plugin"?
But I can't not find any docker setting file under /etc/default/* in my jenkins container, so I can't set the DOCKER_OPTS argument.
Could someone give me any advise? Thank you !
Problem context: end of Chapter 3 exercise from the book "Continuous Delivery with Docker and Jenkins" by Rafal Leszko
from Configure and troubleshoot the Docker daemon page
Important: Setting hosts in the daemon.json is not supported on Docker Desktop for Windows or Docker Desktop for Mac.
Setting the docker host uri does NOT work on Windows. So either of these won't work in the Settings > Daemon tab:
"hosts" : "-H tcp://0.0.0.0:2375"
"DOCKER_OPTS" : "-H tcp://0.0.0.0:2375"
Exposing the daemon without TLS (checkbox on General tab) as recommended in some places did not work for me either.
The solution to connecting the Docker plugin in Jenkins with the docker host, is:
use the special DNS name host.docker.internal
From the docs:
How do I connect from a container to a service on the host?
Windows has a changing IP address (or none if you have no network access). We recommend that you connect to the special DNS name host.docker.internal, which resolves to the internal IP address used by the host. This is for development purposes and will not work in a production environment outside of Docker Desktop for Windows.
The gateway is also reachable as gateway.docker.internal.
For more information about the networking features in Docker Desktop for Windows, see Networking.
While the 'will not work in a production environment outside of Docker Desktop for Windows' disclaimer might bother some, I believe Docker for Windows is not meant for production use cases anyway.
Additionally, publish this mapping for Jenkins agent-master communication -p 50000:50000

Resources