How to register a proxy-server for the puppeteer with a link to a docker container with tor-proxy?

Good day,

Did the side for scrapper using 2 containers -
node (for a puppeteer) and tor-socks-proxy
(The Assembly has tried to produce networks with and without, the result is the same):

version: '3.7'
services:
node:
 container_name: app_node
 build: ./docker/containers/node
volumes:
 - ./app:/var/www
 - ./volumes/node/nginx/:/var/log/nginx/
ports:
 - 3002:3000
 working_dir: /var/www
 restart: always
 tty: true
networks:
 - myapp
tor:
 container_name: app_tor
 image: peterdavehello/tor-socks-proxy:latest
ports:
 - 9150:9150
 restart: always
networks:
 - myapp

networks:
myapp:
 driver: bridge


The problem with using the Torah proxy for puppeteer in the container node:

When I used the local tor proxy, I pointed out the address:

'--proxy-server=socks5://127.0.0.1:9050'

Changed to:

'--proxy-server=socks5://tor:9050'

export const LAUNCH_PUPPETEER_OPTS = {
 args: [
 .. 
'--proxy-server=socks5://tor:9050'
]
};


When you run puppeteer:

Error: net::ERR_PROXY_CONNECTION_FAILED at https://sitename.ru
at navigate (/var/www/node_modules/puppeteer/lib/FrameManager.js:120:37)
at processTicksAndRejections (internal/process/task_queues.js:86:5)
-- ASYNC --
at Frame. (/var/www/node_modules/puppeteer/lib/helper.js:111:15)
at Page.goto (/var/www/node_modules/puppeteer/lib/Page.js:672:49)
at Page. (/var/www/node_modules/puppeteer/lib/helper.js:112:23)
at PuppeteerHandler._callee2$ (/var/www/helpers/puppeteer.js:69:19)
at tryCatch (/var/www/node_modules/regenerator-runtime/runtime.js:45:40)
at Generator.invoke [as _invoke] (/var/www/node_modules/regenerator-runtime/runtime.js:271:22)
at Generator.prototype.(anonymous function) [as install] (/var/www/node_modules/regenerator-runtime/runtime.js:97:21)
at asyncGeneratorStep (/var/www/helpers/puppeteer.js:12:103)
at _next (/var/www/helpers/puppeteer.js:14:194)
at processTicksAndRejections (internal/process/task_queues.js:86:5)

Locally fulfills the following command:

curl --socks5-hostname 127.0.0.1:9150 https://ipinfo.tw/ip


62.102.148.68

From under the container tor too:

docker exec-i-t 5bdddac72709 curl --socks5-hostname 127.0.0.1:9150 https://ipinfo.tw/ip

89.144.12.17
From under the container node is similar:
docker exec -it 03c2c7be89f8 curl --socks5-hostname tor:9150 https://ipinfo.tw/ip

166.70.207.2

Prompt please, in what a jamb - in port or the host?

Also, I tried to install tor into the container node and configure as follows:

'--proxy-server=socks5://127.0.0.1:9050'

The result is not changed.

Maybe in addition to the curl you need additional utilities of deinstalling in the container node?
April 7th 20 at 11:56
1 answer
April 7th 20 at 11:58
Solution
you have all different ports. somewhere 9050 , 9150 somewhere.
Thank you! - Kailee commented on April 7th 20 at 12:01

Find more questions by tags DockerNode.jsTor