docker Connection refused - ruby-on-rails

I have running docker and when want to send request from docker to my rails server
i have got
curl localhost:3000
curl: (7) Failed connect to localhost:3000; Connection refused
but my rails server has been started.
docker version
Client:
Version: 1.9.1
API version: 1.21
Go version: go1.4.3
Git commit: a34a1d5
Built: Fri Nov 20 17:56:04 UTC 2015
OS/Arch: darwin/amd64
Server:
Version: 1.12.3
API version: 1.24
Go version: go1.6.3
Git commit: 6b644ec
Built: 2016-10-26T23:26:11.105168198+00:00
OS/Arch: linux/amd64
i have started docker with eval "$(docker-machine env default)"
upd My rails server outside docker container

As I see you use docker-machine so you have to use the docker-machine IP and not localhost. To get docker-machine IP, use docker-machine ip command.

Related

docker version calling wrong ip address

when I write docker version in cmd I get this error.
error during connect: Get "http://127.0.0.1:12375/v1.24/version": dial tcp 127.0.0.1:12375: connectex: No connection could be made because the target machine actively refused it.
Client:
Cloud integration: 1.0.17
Version: 20.10.8
API version: 1.41
Go version: go1.16.6
Git commit: 3967b7d
Built: Fri Jul 30 19:58:50 2021
OS/Arch: windows/amd64
Context: default
Experimental: true
It is localhost:12375 instead of localhost:2375.
The docker command line uses the environment variable DOCKER_HOST to specify the url of the docker daemon to interact with. Check where you have that value set and update with the correct URL.

How can a Docker Container listen on the same Port like the IDE?

Normally the IDE should tell me, that a port is already in use, if there is a docker container which forwards its port to the same port - for example 8080.
I am using Docker for Mac in version:
Client:
Version: 18.03.1-ce
API version: 1.37
Go version: go1.9.5
Git commit: 9ee9f40
Built: Thu Apr 26 07:13:02 2018
OS/Arch: darwin/amd64
Experimental: false
Orchestrator: swarm
Server:
Engine:
Version: 18.03.1-ce
API version: 1.37 (minimum version 1.12)
Go version: go1.9.5
Git commit: 9ee9f40
Built: Thu Apr 26 07:22:38 2018
OS/Arch: linux/amd64
Experimental: true
docker ps (summary):
CONTAINER ID IMAGE STATUS PORTS
<some-id> my-app Up 3 seconds 0.0.0.0:8080->8080/tcp
IDE in Debugging mode (Spring Boot App):
...Tomcat started on port(s): 8080 (http)
When I send a curl request the app from the container sends the response. I know that, because there is a break point in the IDE. When I stop the docker container, the request stops at the break point.
How can these two processes listen on the same port?

Docker can create a new swarm

I am using the docker docs to create a swarm
https://docs.docker.com/engine/swarm/swarm-tutorial/create-swarm/
[centos#dsm-manager1 ~]$ docker swarm init --advertise-addr 10.192.10.220
Error response from daemon: --live-restore daemon configuration is incompatible with swarm mode
[centos#dsm-manager1 ~]$
The version of docker I'm using
[centos#dsm-manager1 ~]$ docker version
Client:
Version: 1.12.6
API version: 1.24
Package version: docker-common-1.12.6-11.el7.centos.x86_64
Go version: go1.7.4
Git commit: 96d83a5/1.12.6
Built: Tue Mar 7 09:23:34 2017
OS/Arch: linux/amd64
Server:
Version: 1.12.6
API version: 1.24
Package version: docker-common-1.12.6-11.el7.centos.x86_64
Go version: go1.7.4
Git commit: 96d83a5/1.12.6
Built: Tue Mar 7 09:23:34 2017
OS/Arch: linux/amd64
The doc version is 1.17,I don't know whether this matters,
I just can't find the doc about swarm mode in version 1.12
For those who can’t find /etc/docker/daemon.json try /etc/sysconfig/docker
live-restore option is there:
OPTIONS=’–selinux-enabled --log-driver=journald --live-restore’

Can't get Docker image after windows installation

I just installed docker on my windows 10 server,
Installation went fine but I can't seem to get images from central docker repo.
those are my specs:
c:\>docker version
Client:
Version: 1.13.0
API version: 1.25
Go version: go1.7.3
Git commit: 49bf474
Built: Wed Jan 18 16:20:26 2017
OS/Arch: windows/amd64
Server:
Version: 1.13.0
API version: 1.25 (minimum version 1.12)
Go version: go1.7.3
Git commit: 49bf474
Built: Wed Jan 18 16:20:26 2017
OS/Arch: linux/amd64
Experimental: true
This is my test command:
c:\>docker run hello-world
Unable to find image 'hello-world:latest' locally
docker: Error response from daemon: Get https://registry-1.docker.io/v2/: remote error: tls: access denied.
See 'docker run --help'.
This is what I get when running curl on that repo:
c:\>curl -k https://registry-1.docker.io/v2/
{"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":null}]}
I guess that there is something to do with my company DNS/Network,
did anyone encounter this issue on windows?
You need to set your proxy env variables.
[Environment]::SetEnvironmentVariable("HTTP_PROXY", "http://username:password#proxy:port/", [EnvironmentVariableTarget]::Machine)
Restart-Service docker
Check this for reference: https://learn.microsoft.com/en-us/virtualization/windowscontainers/manage-docker/configure-docker-daemon
And more common:
https://docs.docker.com/engine/admin/systemd/#http-proxy
As I replied to #Falco Alexander I got some PowerShell errors, But The proxy was already set in my env. variables.
What finally did the trick was to set the proxy inside the docker GUI:
And then restart the service.

Docker Compose (docker-compose) couldn't connect to docker daemon on Windows Server 2016 TP5

I am trying to get docker-compose to work on Windows Server 2016 TP5. I have installed Docker Desktop for Windows (not Docker Toolbox) as a service, which works perfectly. I have downloaded the latest docker-compose for windows from https://dl.bintray.com/docker-compose/master/ and put it in the same path as Docker (after unblocking the downloaded file, and renaming it to docker-compose.exe.
When I run the docker-compose up (in Powershell as an Administrator), I get the following error:
ERROR: Couldn't connect to Docker daemon. You might need to install
Docker:
https://docs.docker.com/engine/installation/
Here are the docker and docker-compose information on my machine:
Docker:
Client:
Version: 1.12.1
API version: 1.24
Go version: go1.6.3
Git commit: 23cf638
Built: Thu Aug 18 17:52:38 2016
OS/Arch: windows/amd64
Server:
Version: 1.12.1
API version: 1.24
Go version: go1.6.3
Git commit: 23cf638
Built: Thu Aug 18 17:52:38 2016
OS/Arch: windows/amd64
Docker Compose:
docker-compose version 1.9.0dev, build f65f89a
You might want to try to set your DOCKER_HOST:
$ENV:DOCKER_HOST="npipe://\\.\pipe\docker_engine"
Alternatively, when registering the engine, you can make it listen on TCP too:
dockerd.exe -H npipe:////./pipe/docker_engine -H localhost:2375 --register-service
There are more details on this Compose issue

Resources