Headless Chromium on ARM Docker - Segfault - docker

I own an instance at Oracle Cloud that is running on ARM64 platform.
I try to run the headless Chrome Docker instance, but it always fails.
What did I do:
Built a docker image
Wrote a small JS snippet that uses the Puppeteer to make screenshots
Ran all the things together against https://example.com in order to get the screenshot.
What goes wrong:
Every time, when the code tries to launch the headless version of Chrome, it fails. Either with an explicit "Segmentation fault" or with more sophisticated "Received signal 11 SEGV_ACCERR 0041b4601000".
Looks like, no version of Chrome/Chromium that is ready to be launched on ARM64 platform exists.
What I tried:
Alpine Linux from scratch
Alpine Linux with preinstall NodeJS environment
Ubuntu Linux
Ubuntu Linux with the installation through dpkg -i
The question:
Do you know a way to run the headless Chrome/Chromium inside of an ARM64-based docker instance?

Related

visual-studio-code : failed to connect. is docker installed?

my environment :
MacOS M1 chip
VSCode version 1.66.2 arm64
local installed docker version : 20.10.22
I have situations that docker is not working in VSCode.
I already installed docker in local. But when I'm trying to connect docker in VSCode, repeatedly asking install docker extensions. (but I do have docker already ). and if I do reinstall with following the VSCode, the docker version was broken (changed to intel chip docker).
Does anybody know what's wrong?
Docker Extensions for VS Code have nothing to do with the Docker engine itself. They are like an additional layer of tools and commands over the installed Docker. E.g. they provide IntelliSense for editing Docker-related files, you can run Docker commands from F1 drop-down, etc. But you should be able to do all the required tasks even without Docker Extensions, e.g. from the Terminal in VS Code, but for this the path to Docker CLI (command line interface) should be added to PATH environment variable.
If you are getting failed to connect error then maybe Docker engine is not running. Please refer to https://docs.docker.com/desktop/install/mac-install/ and https://docs.docker.com/desktop/troubleshoot/overview/ about how to check if the engine is running and how to troubleshoot the issues.
If that doesn't help, please provide some specific error and steps, which led to it, then we'll try to find out.

installing shopware 6 on windows with docker

I am trying to install shopware 6 on a windows 10 machine with docker.
Docker seems to work, if I run: "docker --version" I get:
Docker version 18.09.2, build 6247962
and if I run: "docker run hello-world" I get:
This message shows that your installation appears to be working correctly.
But if I try to run: "psh.phar docker:start" as mentioned in the sw6 Installation guide (https://docs.shopware.com/en/shopware-platform-dev-en/getting-started/installation-guide#docker-installation-recommended) nothing happens.
There is no error or message, just nothing happens.
phar files will require a running php instance on your windows. Try "php -v" to check if your windows can use php. Otherwhise you need to installl it. Running docker native on windows might cause some additional issues, so you might want to run it inside the linux subsystem to avoid those issues.

WebDriverError: invalid session id

I am trying to containerize the automation tests to run in docker environment. When the build runs on the automation code, it creates an docker image and updates in DTR. I have a separate jenkins pipeline which runs the automation commands in the docker image and uploads the results in the workspace. All of this setup working in fine in non-docker environment (ie., on local mac terminal), but the same tests are failing in docker environment. I am trying to figure out a solution, but it doesn't seem to work.
I get below errors when running the protractor tests in docker environment
After # test/cucumber/stepDefinitions/hooks.ts:31
WebDriverError: invalid session id
(Driver info: chromedriver=73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72),platform=Linux 4.9.125-linuxkit x86_64)
I built my docker image FROM circleci/node (https://hub.docker.com/r/circleci/node/) and this image has required libraries installed (node, npm,yarn, chrome and chrome drivers).
Before running the tests I made sure the protractor, cucumber and webdriver modules are installed.
Even then, i am trying to install chrome and chrome driver while building the image using apt-get package manager.
The docker env is on Debian GNU/Linux 9 \n \l
The chrome driver version is
73.0.3683.75-1~deb9u1
Google Chrome version is 73.0.3683.103
I am running headless
Making sure the webdriver manager is updated before starting it
Web driver version 13.0
Running below:
webdriver-manager update --ignore_ssl --versions.chrome 73.0.3683.75-1~deb9u1
webdriver-manager start --detach
protractor test/cucumber/config/cucumberConfig.ts
I expect all the tests to run in docker environment in the same way it ran in mac terminal, but getting below errors:
And Log out application # test/cucumber/stepDefinitions/common-step-def.ts:64
✖ After # test/cucumber/stepDefinitions/hooks.ts:31
WebDriverError: invalid session id
(Driver info: chromedriver=73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72),platform=Linux 4.9.125-linuxkit x86_64)
at Object.checkLegacyResponse (/node_modules/selenium-webdriver/lib/error.js:546:15)
at parseHttpResponse (/node_modules/selenium-webdriver/lib/http.js:509:13)
at doSend.then.response (/node_modules/selenium-webdriver/lib/http.js:441:30)
at
at process._tickCallback (internal/process/next_tick.js:189:7)
From: Task: WebDriver.takeScreenshot()
at thenableWebDriverProxy.schedule (/node_modules/selenium-webdriver/lib/webdriver.js:807:17)
at thenableWebDriverProxy.takeScreenshot (/node_modules/selenium-webdriver/lib/webdriver.js:1085:17)
at run (/node_modules/protractor/built/browser.js:59:33)
at ProtractorBrowser.to.(anonymous function) [as takeScreenshot] (/node_modules/protractor/built/browser.js:67:16)
at World. (/test/cucumber/stepDefinitions/hooks.ts:36:17)
Any thoughts?
I run into the same problem recently. It looks like browser instance can't start due to some reason. In my case adding --disable-dev-shm-usage to chrome-options solved the issue.
ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-dev-shm-usage");
ChromeDriver driver = new ChromeDriver(options);
Why this helps:
By default, Docker runs a container with a /dev/shm shared memory space 64MB. This is typically too small for Chrome and will cause Chrome to crash when rendering large pages. To fix, run the container with docker run --shm-size=1gb to increase the size of /dev/shm. Since Chrome 65, this is no longer necessary. Instead, launch the browser with the --disable-dev-shm-usage flag:
~ Google troubleshooting guide
According to that, another idea would be to try using --shm-size=1gb when running the container if you really want to use /dev/shm.
May be check the Chrome version compatible with the OS version you are using in the Docker.
From the logs it seems the page is not even loaded or crashed on loading. Either it requires more memory to load the page or the chromes extensions might have been enabled.
try adding these options to config
chromeOptions: {
args: [
'incognito',
'disable-extensions',
'disable-infobars',
]
}

Use a Docker container as an install set

I'm currently building a Docker container that contains all the libraries needed for deployment of our app on a test machine, such as, for example, OpenCV 3.3 built with CUDA 9.
So, on a clean minimal OS install we can download the container and fire up our app in the desired environment, which is as I understand it one of the main reasons to use Docker.
So, after a while we decide to do our tests on the bare metal without the Docker file system, etc, in the way. Can we somehow replay the Dockerfile commands or image command history to run the apt-get, etc of not just the current package, but all FROM packages that are not yet installed on the raw environment?

How did Docker know to emulate arm architecture?

This was a huge surprise for me:
Today, using Docker For Mac (18.03.1-ce-mac65), I ran a Debian Stretch image. Inside the image I mounted the latest Raspbian Stretch image (2018-04-18-raspbian-stretch-lite) using mount. I then used chroot to this mounted Raspbian filesystem.
This is where it got weird. I was able to use apt (without any special modifications) to install software into this mounted filesystem.
Running:
dpkg --print-architecture
returned: armfh
and the software I installed (vim) worked like a charm
I was even able to compile a simple program using gcc and run it.
But, I need to know! How is this possible?
According to Docker:
Docker for Mac provides binfmt_misc multi architecture support, so you can run containers for different Linux architectures, such as arm, mips, ppc64le, and even s390x.
EDIT
On Linux, you can install qemu-user-static and then follow this git repo to get cross-architecture support!

Resources