Connection refused when pulling docker image on windows server - docker

After installing docker on a windows server i got the following error when pulling a image with docker run hello-world command:
Error response from daemon: Get https://hub.docker.com/v2/: dial tcp
52.6.16.15:443: connectex: No connection could be made because the target machine actively refused it.

The problem was that the proxy was blocking the request.
After some headaches, i finally got how to setup up proxy for docker on windows server from the right guide:
Using powershell in elevated mode:
Set environment variable to HTTP_PROXY environment variable
[Environment]::SetEnvironmentVariable("HTTP_PROXY", "http://username:password#proxy:port/", [EnvironmentVariableTarget]::Machine)
May not need to specify credentials, if your proxy don't require it.
Restart docker
Restart-Service docker
Now it should run:
docker run hello-world

Related

Docker Windows dial tcp 127.0.0.1:2376: connectex: No connection could be made because the target machine actively refused it

I just installed Docker Desktop on Windows 10 and while running the command docker run hello-world, I keep getting the error "dial tcp 127.0.0.1:2376: connectex: No connection could be made because the target machine actively refused it"
Any solution to this problem, From other stackoverflow answers, I deleted the DOCKER_* env variables, but it did not solve the problem.
I even selected "Expose daemon on tcp://localhost:2375 without TLS" option as told by the answer in this link: Docker: No connection could be made because the target machine actively refused it
There were some solutions involving docker-machine command (see the link), but the windows powershell cannot find the command.
Any help is appreciated.
Remove DOCKER_TLS as well as DOCKER_HOST environment variables. Have your docker desktop running.
Then try executing:
docker run -d -p 80:80 docker/getting-started
It should work.

Unable to connect to localhost of machine from docker container

My GCP ES service is port forwarded to localhost:9200 of my machine. I am able to log ingest from the local machine.
I have created JAVA script to do the same task and It is also running fine when I am running local
Now, I have created docker Image of that Java project using dockerFile and when I am creating a container, then I am getting the following error
Connect to localhost:9200 [localhost/127.0.0.1] failed: Connection refused (Connection refused)
Docker command :
docker run -it --net="host" gcplogingest:latest mvn -f BEATLe/pom.xml test -Dcomponent=detect -DtestSuite=CommonXML/Detect_loginjectionGCP
Note :
I have tried using --network="host" but I am still getting the same error.
Please suggest.
Have you tried removing --net=host and then use in your docker host.docker.internal instead 127.0.0.1?
Consider that your host localhost should be different than your docker localhost, and once you get that removing network=host, you need to access from docker to
host.docker.internal:9200

Error while trying to pull docker image in IBM Cloud VM behind proxy server

Get https://registry.access.redhat.com/v1/_ping: proxyconnect tcp:
dial tcp: lookup =https: no such host
We are trying to pull docker image in our VM which has os RHEL7.
docker pull hello-world
Getting below error while running the above command.
Get https://registry.access.redhat.com/v1/_ping: proxyconnect tcp: dial tcp: lookup =https: no such host
Our VM is behind a proxy server. Also we have configured docker to use the proxy server as well.
Confirmed the proxy config for docker by running below command -
sudo systemctl show --property=Environment docker
and output is as below -
Environment=GOTRACEBACK=crash DOCKER_HTTP_HOST_COMPAT=1 PATH=/usr/libexec/docker:/usr/bin:/usr/sbin HTTPS_PROXY=https://xx.xx.xx.xx:443/ HTTP_PROXY=http://xx.xx.xx.xx:80/
However if I do wget https://registry.access.redhat.com/v1/_ping, it works fine. Anything I am missing in the configuration?
this error has no specific solution, after googling you may try one of the following:
1- change DNS to 8.8.8.8 in /etc/resolv.conf.
2- just restart Docker daemon.
3- Uninstall and re-install Docker.
4- Follow the steps in Docker to setup the proxy.

An error occurred trying to connect - docker when not using sudo

I am on ubuntu 14.04 and unless I use sudo to run docker commands I get this error:
$ docker images
An error occurred trying to connect: Get http://vagrant.f8:2375/v1.24/images/json: dial tcp: lookup vagrant.f8 on 127.0.0.1:53: no such host
I have uninstalled vagrant, re-installed docker and still have this error. Is this some kind of baked in config that I haven't been able to remove?
The $DOCKER_HOST is used to tell the docker CLI where to connect for all commands. It looks like you've configured yours, possibly from a docker-machine setting, to a host you're no longer using. You can unset $DOCKER_HOST to send all requests to the local /var/run/docker.sock socket. Or you can configure it to match the value of your root user.
Docker can be configured to listen to 2375 (unencrypted) or 2376 (tls certificate setup required) with additional flags to the daemon, but if you have not configured these, unsetting the variable is most likely your solution. If you were using docker-machine, then eval $(docker-machine env -u) is likely what you want to run.

Docker exporting container

My Docker install has problems and no longer works properly. When I try to use docker export [containername].
I get the following error
FATA[0000] Get http://%2Fvar%2Frun%2Fdocker.sock/v1.18/containers/json: dial unix /var/run/docker.sock: connect: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?
I would like to move the containers on this machine to a new machine that I have setup.
Is there a way to move the containers without using the CLI?
Not sure this is a CLI issue. Technically when you run a docker command it goes CLI > API > Docker daemon. Locally, the API is listening on a UNIX socket but your error says there's nothing listening on the socket. Is your Docker daemon running?

Resources