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',
]
}
Related
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.
I am using PyCharm with docker interpreter on macbook with M1. At some point of time it stopped generating code skeletons, providing autocompletion and run debug mode of my code.
When I've tried to run PyCharm in Debug mode it stated me 502 docker error.
Reseting to factory defaults and re-installations didn't helped.
The reason of issue was Docker Desktop's Beta feature Use containerd for pulling and storing images. It failed the whole process. Uncheck it and live happily.
I set up a Windows GitLab runner that's supposed to download a Docker image from our Container Registry and then run a build script in the pipeline. Unfortunately the Docker container never launches due to the following error:
Running with gitlab-runner 15.1.0 (76984217)
on WindowsDockerRunner wZMWQZYi
Resolving secrets
Preparing the "docker-windows" executor
Using Docker executor with image mcr.microsoft.com/windows/servercore:ltsc2019 ...
Pulling docker image mcr.microsoft.com/windows/servercore:ltsc2019 ...
Using docker image sha256:e6b07227af5ca9303c2112b574f6f27f38135bbf9df29d829142410221967401 for mcr.microsoft.com/windows/servercore:ltsc2019 with digest mcr.microsoft.com/windows/servercore#sha256:26c6c296a4737ba478fe3c3e531b098f89b5562c40b416ba6fb8177ac462d1af ...
Preparing environment
Running on RUNNER-WZMWQZYI via
runner2...
ERROR: Job failed (system failure): prepare environment: Error response from daemon: invalid condition: "not-running". Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information
The error message doesn't clearly state what the cause of the problem is and the documentation that it references doesn't mention anything about "condition". Based on the link pointing to shell profiles I suspect it might have something to do with the shell that's being run, but when I run the Docker container locally it boots into PowerShell just fine.
Does anyone know how to solve this?
I came across this issue after installing Docker Engine using the Windows Server install script, which fetches docker.exe and dockerd.exe from https://master.dockerproject.org, These builds were last updated in March 2022, I found gitlab-runner 14.9 and earlier work okay with this version (released prior to March 2022), but 14.10 does not (released 2022-04-19) nor do any newer versions.
Installing Docker Desktop resolves this as it provides the latest version. However using Docker Desktop introduces licensing issues. An alternative is to manually install Docker Engine / update the version downloaded by the Microsoft script.
Docker Engine builds are provided on the Moby GitHub project to download from https://download.docker.com/win/static/stable/x86_64/ downloading the lastest version from here and replacing the docker executables in C:\Windows\System32 fixes the problem, working with the latest gitlab-runner.
An alternative is to use the docker-engine chocolatey package (which incidentally I maintain) which provides installation scripting for the above stable builds:
choco install docker-engine
There is also an open issue with the Windows-Containers team to move off (out of date) nightlies: https://github.com/microsoft/Windows-Containers/issues/256 which would provide a stable docker build, through the Microsoft recommended installation method.
Was finally able to solve this issue. We had the Docker Engine installed on our GitLab Runner, but that doesn't seem to be sufficient for GitLab CI/CD. After installing Docker Desktop on the runner the issue disappeared and we were able to run the pipeline.
After some trial and error I got it up and running.
I have another server running the gitlab-runner and docker without any issues (no docker desktop installed, which is not allowed because of licensing stuff).
The server I'm trying to setup right now is a 'redundancy' build server.
So to find out what was my problem, I started switching things from one build server to the other. Currently, it appears that simply downgrading to the gitlab-runner V13.4.0 was enough.
I did reregister the runner, since gitlab stated that the V15.x.x version was using executor "unknown".
Not sure what is going on there, but at least I can continue building now.
Docker Desktop is not starting after adding ".wslconfig" file.
I followed steps given in link-
https://mrakelinggar.medium.com/set-up-configs-like-memory-limits-in-docker-for-windows-and-wsl2-80689997309c
https://itnext.io/wsl2-tips-limit-cpu-memory-when-using-docker-c022535faf6f
When Starting docker desktop getting error message-
It look like there is an error with Docker Desktop,restart it to fix it.
.wslconfig file-
[wsl2]
memory=3GB # Limits VM memory in WSL 2 up to 3GB
processors=4 # Makes the WSL 2 VM use two virtual processors
Snap-
Question - if the error goes away after removing the .wslconfig file?
Ans- No
Then I installed Docker Desktop using Hyper V instead of wsl-2.
But When I restart laptop, Docker Desktop again failed to start in this method also.
Git Issue- https://github.com/docker/for-win/issues/11822
C:\Users[USER]\AppData\Local\Docker
C:\Users[USER]\AppData\Roaming\Docker
C:\Users[USER]\AppData\Roaming\Docker Desktop
Once deleted, I didn’t have to do anything else, Docker Desktop started booting up as normal.
After Deleting above files docker starts but it's like resetting the docker.
After that I restart my laptop to check whether Docker Runs or not after restarting laptop.
But Still facing same issue.Docker Desktop is not starting.
Current Docker Version - 4.9.0
Snap-
Finally, Docker Desktop started running after downgrading the Docker Desktop version form "4.9.0" to "4.8.0", which is one of solution share in below post.
The issue was not with ".wslconfig", the issue was Docker Desktop Version.
Current Docker Desktop version 4.8.0 is working on both "Hyper V" and "wsl-2"
http://www.dev.fyicenter.com/1001459_Docker_failed_to_initialize_Error.html
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?