The error message is "Failed to move to new namespace: PID namespaces supported. Network namespace supported, but failed: errno = Operation not permitted"
Solutions
Just choose one of the solutions below.
For Docker
Add --cap-add SYS_ADMIN
for docker run
to gain the permission
For example:
$ docker run -it \
--cap-add=SYS_ADMIN \
-e PYTHONPATH=$(container_work_dir)
-p $(site_port_mapping)
-p $(admin_port_mapping)
-p $(https_port_mapping)
-w $(container_work_dir)
--name $(project_name)`
For Selenium
Add --no-sandbox
while launching Chrome driver
For example:
from selenium import webdriver
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--no-sandbox')
chrome = webdriver.Chrome(chrome_options=chrome_options)
References
- https://github.com/jessfraz/dockerfiles/issues/65
- https://stackoverflow.com/questions/43665276/how-to-run-google-chrome-headless-in-docker
- https://github.com/jessfraz/dockerfiles/issues/17
- https://github.com/SeleniumHQ/docker-selenium/issues/383
- https://github.com/elgalu/docker-selenium/issues/58
- https://github.com/Chatie/wechaty/commit/e68483833f85cfc59879da0daf62f275a0ef9db8
Share
Donation
如果覺得這篇文章對你有幫助, 除了留言讓我知道外, 或許也可以考慮請我喝杯咖啡, 不論金額多寡我都會非常感激且能鼓勵我繼續寫出對你有幫助的文章。
If this blog post happens to be helpful to you, besides of leaving a reply, you may consider buy me a cup of coffee to support me. It would help me write more articles helpful to you in the future and I would really appreciate it.
Related Posts
- Y2017W26
- Y2016W38
- Python Selenium ChromeDriver unknown error: session deleted because of page crash
- Bypass Cloudflare detection while using Selenium with ChromeDriver
- CircleCI Python docker image cannot connet to website uses TLSv1.0