Failed to Docker login to JFrog Artifactory running in a Docker - 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.

Related

Jenkins container is not getting connecting to remote using ssh?

I have two docker container one with Jenkins and one is remote container. I want to Run a Jenkins job on remote container.
For that I have given the private keys in credentials, but still connection is not successful.
I am able to ping remote container using Jenkins container also I am able to ssh to remote container using Jenkins container.
See the screenshot below.
How are you connecting with remote host ?? Can you please share the ssh command ?
Can you please share output of below command from your Jenkins container :
cat /etc/hosts
There might be possibility that Jenkins container is able to connect using IP but not using the host_name. Try updating the the /etc/hosts file with remote container host name and then connect.
eg: 172.0.0.1 remote_host local_host
Also If you have used port forwarding, then you can simply connect with base server IP and different ports assigned to those containers.

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

Access docker remote API from container

I'm trying to access Docker remote API from within a container because I need to start other containers.
The host address is 172.19.0.1, so I'm using http://172.19.0.1:2375/images/json to get the list of images (from host, http://localhost:2375/images/json works as expected.
The connection is refused, I guess because Docker (for Windows) listens on 127.0.0.1 and not on 0.0.0.0.
I've tried to change configuration (both from UI and daemon.json) adding the entry:
"hosts": ["tcp://0.0.0.0:2375"]
but the daemon fails to start. How can I access the api?
You can set DOCKER_OPTS in windows as below and try. In Windows, Docker runs inside a VM. So, you have to ssh into the VM and make the changes.
DOCKER_OPTS='-H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock'
Check if it works for you.
Update :- To ssh into the VM (assuming default is the VM name you have created using Docker toolbox), enter the following command in the Docker Quickstart Terminal,
docker-machine ssh default
You can find more details here.
You could link the host's /var/run/docker.sock within the container where you need it. This way, you don't expose the Docker Remote API via an open port.
Be aware that it does provide root-like access to docker.
-v /var/run/docker.sock:/var/run/docker.sock
You should use "tcp://host.docker.internal:2375" to connect to host machine from container. Please make sure that you can ping the "host.docker.internal" address
https://github.com/docker/for-win/issues/1976

Cannot login to Nexus 3 docker registry

I have set up an AWS EC2 instance with Docker, Nexus3 and a Docker repository in Nexus with HTTP port 8123 and all the necessary settings so that I can see it from Docker. I have added after a lengthy research the right options in my docker config file so that when I run docker info I can see my insecure registry set to the right IP address. I can access the url of the Nexus manager from my machine without any problems and I can create repositories etc.
I then try to do a docker login from within my EC2 instance like this:
docker login -u admin -p admin123 my_ip_address:8123
And after a while I get this:
Error response from daemon: Get http://my_ip_address/v1/users/: dial tcp my_ip_address:8123: i/o timeout
I have tried so many things to fix this and nothing seems to work. I spent so far an entire day trying to understand why docker login cannot see my Nexus3 registry.
Any ideas?

docker machine: getsockopt no route to host

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

Resources