As for Docker in ngnix to set up a domain using the hosts file ?? How it all zapustit??

I myself am not very rummaging in the administration here decided to play around Docker. I have been collecting container at this site: https://phptoday.ru/post/gotovim-lokalnuyu-sredu-d... it worked except for the last paragraph.
Can't make a domain for your site ie site on local ip 127.0.0.1 and localhost are available at hello.dev no. All files and folders are also decorated and made as the user of this , the only changed docker-composer here in this part where there primatarova your hosts file:
services:
nginx:
 # use the latest stable nginx image
 image: nginx:latest
 # marrucinorum ports
ports:
 - "80:80"
 - "443:443"
 # mount the directory to the left directory of the primary machine, right where they are mounted in the container
volumes:
 - ./hosts:/etc/nginx/conf.d
 - ./hosts/hosts/etc/hosts
 - ./www:/var/www
 - ./logs:/var/log/nginx
 # nginx needs to communicate with the php container
links:
 - php


the hosts file like this :
127.0.0.1 localhost
127.0.0.1 hello.dev

::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.18.0.4 84d108cbe9f9
June 14th 19 at 20:58
3 answers
June 14th 19 at 21:00
Solution

- ./hosts/hosts/etc/hosts

no need

the host must be prescribed on the basis of the system in the /etc/hosts
June 14th 19 at 21:02
Solution
1. ping hello.dev
what shows? should be 127.0.0.1
2. to mount hosts in the container is not necessary if only your website will not search for itself in the domain name.
3. see config virtual host in nginx. Most likely the problem.
4. describe the situation in more detail. For example what means "and at hello.dev no."
5. work on Russian. Errors are terrible, annoying when reading.
Thanks , will take note of , the problem was solved. The catch was in the 3rd item on your list.
I have a new question, can I ask you.
I just deal with Docker and sometimes nerves from ignorance pass.
The real question is the following: I have here is a docker-compose.yml

# Use root/example as user/password credentials
version: '3.3'

services:

db:
 image: mysql
ports:
 - 3306:3306
volumes:
 - ./db:/var/lib/mysql 
 restart: always
environment:
 MYSQL_DATABASE: db_ferst
 MYSQL_USER: root
 MYSQL_PASSWORD: root
 MYSQL_ROOT_PASSWORD: root


adminer:
 image: adminer
 restart: always
ports:
 - 8080:8080


I run the script sudo docker-compose up-d
all runs, I go to the page localhost:8080

enter data:
59d22d90ac870413223459.png

and I have error: SQLSTATE[HY000] [2002] Connection refused

and I can't understand what am I doing wrong ?

database: I not correctly entered , properly db_ferst but this is not what has changed - yolanda.Ledn commented on June 14th 19 at 21:05
and now climbs error SQLSTATE[HY000] [2002] No such file or directory here I sit googling - yolanda.Ledn commented on June 14th 19 at 21:08
you say Adminer script to search the database on the same machine where it is running, i.e. localhost 127.0.01
And database you have on the other "server", ie the container.
Docker-compose, when starting containers automatically enter in /etc/hosts of the container corresponds to the IP-name of other containers of a network being created, and adminer will be able to find the database named db (name service) - Willard_Jerde67 commented on June 14th 19 at 21:11
June 14th 19 at 21:04
it is believed that domain you want to configure in DNS and not the hosts file.
the hosts file is one of the configuration files of the DNS. - yolanda.Ledn commented on June 14th 19 at 21:07
there is the view that in spite of this is the domain you want to configure in DNS and not the hosts file. - yolanda.Ledn commented on June 14th 19 at 21:10
, But specifically the question of default, domain hello.dev do not exist in nature, and it is necessary only to create a sandbox. Just hosts the best decision also marked correct. - Willard_Jerde67 commented on June 14th 19 at 21:13
that the hosts here at all at Affairs - Jeff28 commented on June 14th 19 at 21:16

Find more questions by tags DockerLinuxSystem administration