I have dotnet core 2.2 (aspnet core) app running in Docker container. I’m using the simplest possible Dockerfile you can find in any basic tutorial:
microsoft/dotnet:2.2-sdkas base image
- copy *.csproj
- restore packages
- publish to /app folder
microsoft/dotnet:2.2.1-aspnetcore-runtimeto run the app from /app folder
Now I’d like to grab some data from another website. It is a SPA, so I need to use a browser to render the page first – I decided to use Selenium with ChromeDriver because I’m already a little bit familiar with them.
Selenium.WebDriver v3.141 and
Selenium.WebDriver.ChromeDriver v73.0 to my project, set Selenium there. Locally on Windows it works fine. But when I run this via Docker I’m getting:
The file /app/chromedriver does not exist. The driver can be downloaded at http://chromedriver.storage.googleapis.com/index.html
So now I’m wondering how can I run Selenium + single instance Chrome (there is no need to set up Selenium Grid for my purpose) with dotnet core 2.2 in Docker.
I suppose I need to create custom Dockerfile which:
- installs selenium, chrome and all their dependencies
- does the same as my current Dockerfile to build and run my app
But I’m not really sure how to do this. Especially how to “nest” Dockerfiles.
Should I do this composition in a single Dockerfile? Should I create Dockerfile for Selenium + ChromeDriver and use it as base image for next step?