H
H
Hfnas2019-08-21 18:48:46
Docker
Hfnas, 2019-08-21 18:48:46

Why does "Socket error [111]: Connection refused" occur in docker?

There is the main OS - ubuntu, there is an additional OS where the opt.loc site is deployed (I write in php) - docker .. I check
in the main OS (I need to understand which ports are open - I see they are closed: 80,443.):

:~$ nmap -p80,443 opt.loc

Starting Nmap 7.60 ( https://nmap.org ) at 2019-08-21 17:05 MSK
Nmap scan report for opt.loc (127.0.0.1)
Host is up (0.000055s latency).
rDNS record for 127.0.0.1: localhost

PORT    STATE  SERVICE
80/tcp  closed http
443/tcp closed https

Nmap done: 1 IP address (1 host up) scanned in 0.05 seconds

Further, I googled, you need to open the ports by writing "127.0.0.1 opt.loc" on the working machine, on the docker, everything from a new line.
on the working machine /etc/hosts
127.0.0.1       localhost
127.0.0.1       opt.loc

in docker
127.0.0.1       localhost
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.0.1       opt.loc

By the way, I checked it on the main OS
curl http://opt.loc:8080
; it displays html pages, so it works.
-------------------------------------------------- -----
everything worked out, it was necessary to open the ports by adding a line to docker-compose.yml
ports:
      - 80:80
      - 443:443

into the container image that is responsible for the web application (apache+php)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2019-08-21
@Hfnas

where connection, where connection.
The question is where?
Logs, screenshots and that's it. What is the container, how is it running, what docker ps shows, what ports are exposed, etc.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question