Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting --proxy-server #48

Closed
gogo9th opened this issue Jul 22, 2019 · 8 comments
Closed

Setting --proxy-server #48

gogo9th opened this issue Jul 22, 2019 · 8 comments

Comments

@gogo9th
Copy link

gogo9th commented Jul 22, 2019

Hi,

Thanks very much for your very useful chrome-headless docker container. I am trying to set up a chrome container that uses my local web proxy. However, I am not sure how to set the "--proxy-server" argument value for the chrome-headless container... Is it ever supported? If so, I would really appreciate your feedback.

@chrbala
Copy link

chrbala commented Jan 30, 2020

I've been building my own images with the arguments I need, but it would be great if these images supported arbitrary arguments!

@justinribeiro
Copy link
Owner

The chrome-headless containers have CMD and ENTRYPOINT, which will allow you to add arbitrary arguments without custom builds:

image

@gogo9th
Copy link
Author

gogo9th commented Feb 4, 2020

Hi, thanks very much for your answer. I tried the following:

docker run -it -p 9222:9222 --cap-add=SYS_ADMIN justinribeiro/chrome-headless "--proxy-server=64.227.8.188:8181"

but I get the error:

(google-chrome:1): Gtk-WARNING **: 07:47:48.668: cannot open display:

Do you have any idea how I could fix it...?

@gogo9th
Copy link
Author

gogo9th commented Feb 4, 2020

Actually, even if I run the following:

docker run -it -p 9222:9222 --cap-add=SYS_ADMIN justinribeiro/chrome-headless "--proxy-server=64.227.8.188:8181" "--headless"

the container exits immediately.

@justinribeiro
Copy link
Owner

justinribeiro commented Feb 4, 2020

I should have been more clear: the docker documentation explains the process fully Overriding Dockerfile image defaults.

As an example, here's the container running with the full set of flags required in a pure override:

image

@gogo9th
Copy link
Author

gogo9th commented Feb 5, 2020

Thanks very much for your guide, now it works fine!

In fact, I have one last question. I wonder if you know how we can add trusted certificates. I don't see a command line option for adding a certificate:

For me, using a certificate is important rather than adding simply adding the "--ignore-certificate-errors --ignore-certificate-errors-spki-list" options, because otherwise Chrome doesn't cache fetched resources (as they are untrusted)...

@justinribeiro
Copy link
Owner

The container doesn't have a means to consume custom certificates; you'd have to build your own hook to import them into the trust. If you've generated a certificate for say a local server, you can use certutil to do this on linux with something along the lines of:

$ certutil -d sql:$HOME/.pki/nssdb -A -t \"P,,\" -n ./my-local-cert.pem -i  ./my-local-cert.pem"

@gogo9th
Copy link
Author

gogo9th commented Feb 7, 2020

I actually knew about this command, but never imagined using it inside a container to get around this issue. Thanks very much for your tip, again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants