'Can testcontainers be used without internet access?
Good day! Can testcontainers be used without internet access? I downloaded the required containers. They start and run. In this case, when running tests, an error occurs. I have no internet access
Code
container = new BrowserWebDriverContainer<>().withCapabilities(Capabilities.getFirefoxOptions()).withRecordingMode(
webDriverForm.get().isVideoError() ? VncRecordingMode.RECORD_FAILING : VncRecordingMode.RECORD_ALL,
new File(webDriverForm.get().getVideoPath()), VncRecordingFormat.MP4);
ontainer.start();
WebDriver driver = container.getWebDriver();
Error
2021-09-27 17:54:47 INFO Connected to docker:
Server Version: 20.10.8
API Version: 1.41
Operating System: Docker Desktop
Total Memory: 12700 MB
2021-09-27 17:54:47 INFO Image name substitution will be performed by: DefaultImageNameSubstitutor (composite of 'ConfigurationFileImageNameSubstitutor' and 'PrefixingImageNameSubstitutor')
2021-09-27 17:54:48 INFO Credential helper/store (docker-credential-desktop) does not have credentials for index.docker.io
2021-09-27 17:54:49 ERROR Error during callback
com.github.dockerjava.api.exception.InternalServerErrorException: Status 500: {"message":"Get \"https://registry-1.docker.io/v2/\": dial tcp: lookup registry-1.docker.io on 192.168.65.5:53: no such host"}
at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.execute(DefaultInvocationBuilder.java:247)
at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.lambda$executeAndStream$1(DefaultInvocationBuilder.java:269)
at java.lang.Thread.run(Thread.java:748)
Когда пользователь открывает страницу по параметру "https://confluence.ca.sbrf.ru/pages/viewpage.action?pageId=240980441" # CommonStepDefinitionsGUI.loginInFs(String)
com.github.dockerjava.api.exception.InternalServerErrorException: Status 500: {"message":"Get \"https://registry-1.docker.io/v2/\": dial tcp: lookup registry-1.docker.io on 192.168.65.5:53: no such host"}
at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.execute(DefaultInvocationBuilder.java:247)
at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.lambda$executeAndStream$1(DefaultInvocationBuilder.java:269)
at java.lang.Thread.run(Thread.java:748)
at ✽.пользователь открывает страницу по параметру "https://confluence.ca.sbrf.ru/pages/viewpage.action?pageId=240980441"(file:src/test/resources/features/CSA-T1405_Проверка_отображения_Соответствует.feature:6)
Only saved containers can be run in docker.
Containers in Docker
alpine 3.14 14119a10abf4 about 1 month ago 5.6 MB
docker/getting-started latest 083d7564d904 4 months ago 27.99 MB
hello-world latest feb5d9fea6a5 4 days ago 13.26 KB
hello-world <none> d1165f221234 7 months ago 13.34 KB
redis 5.0.3-alpine 3d2a373f46ae over 2 years ago 50.83 MB
selenium/standalone-chrome-debug 2.45.0 d7852787b42a over 6 years ago 750.74 MB
selenium/standalone-firefox-debug 2.45.0 a86fa79ad0c8 over 6 years ago 594.67 MB
testcontainers/ryuk 0.3.2 b24c56207c68 about 2 months ago 11.95 MB
testcontainers/vnc-recorder 1.1.0 e51c318c86f4 over 1 year ago 306.86 MB
Solution 1:[1]
If there is no internet access from your network you have to setup your own docker hub. And you have to upload docker containers there via:
docker tag
docker push
commands
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Nikita Chegodaev |