我正在尝试使用 Selenium Grid 设置一个用于基于 Java 的自动化测试的开发容器。
到目前为止,我的本地工作站上运行着来自 https://github.com/SeleniumHQ/docker-selenium/blob/trunk/docker-compose-v3.yml 的 docker-compose-v3.yml 。我可以通过指向 http://localhost:4444 来运行我的 Java Selenium 项目。
现在,我想让这个项目在 devcontainer 中运行。
为此目的,我有这样的 devcontainer.json 文件:
{
"name": "basic-project",
"build": {
dockerfile: "Dockerfile"
},
"dockerComposeFile": [
"selenium-hub-docker.yml"
],
"service": "selenium-hub",
"features": {
"ghcr.io/devcontainers/features/java:1": {
"version": "11",
"installMaven": "true"
}
},
"customizations": {
"jetbrains": {
"backend": "IntelliJ"
},
"codespaces": {
"openFiles": [
"README.md"
]
},
"vscode": {
"extensions": [
"alphabotsec.vscode-eclipse-keybindings",
"ms-vscode-remote.vscode-remote-extensionpack"
],
"settings": {
"maven.pomfile.prefetchEffectivePom": true
}
}
}
}
Dockerfile 内容:
FROM openjdk:11
LABEL authors="adrianherscu"
并且,
selenium-hub-docker.yml
内容:
version: "3"
services:
chrome:
image: selenium/node-chrome:4.21.0
shm_size: 2gb
depends_on:
- selenium-hub
ports:
- "7900:7900"
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
- VNC_NO_PASSWORD=1
firefox:
image: selenium/node-firefox:4.21.0
shm_size: 2gb
depends_on:
- selenium-hub
ports:
- "7902:7900"
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
- VNC_NO_PASSWORD=1
selenium-hub:
image: selenium/hub:4.21.0
container_name: selenium-hub
ports:
- "4442:4442"
- "4443:4443"
- "4444:4444"
以上所有内容均位于我的 Github 存储库之一中:https://github.com/QA-Automation-Starter/basic-project.git,位于
selenium-hub-docker
分支上。
现在,我尝试通过 IntelliJ 运行它,通过克隆并获取:
Connecting to Docker...
Connecting to Docker... Connected
Reuse sources volume from the previous dev container.
Setting up container features:
Downloading java feature manifest...
Creating directory /var/home/adrianherscu/.cache/JetBrains/DevContainers/devcontainers/features/java
Writing file /var/home/adrianherscu/.cache/JetBrains/DevContainers/devcontainers/features/java/NOTES.md
Writing file /var/home/adrianherscu/.cache/JetBrains/DevContainers/devcontainers/features/java/NOTICE.txt
Writing file /var/home/adrianherscu/.cache/JetBrains/DevContainers/devcontainers/features/java/README.md
Writing file /var/home/adrianherscu/.cache/JetBrains/DevContainers/devcontainers/features/java/devcontainer-feature.json
Writing file /var/home/adrianherscu/.cache/JetBrains/DevContainers/devcontainers/features/java/install.sh
Writing file /var/home/adrianherscu/.cache/JetBrains/DevContainers/devcontainers/features/java/wrapper.sh
Creating jb-devcontainer-features-25e0c2226828cf635710bee8f685e786...
Building image…
Preparing build context archive…
[==================================================>]10/10 files
Done
Sending build context to Docker daemon…
[==================================================>] 26.09kB
Done
Step 1/2 : FROM scratch
--->
Step 2/2 : COPY . /tmp/jb-devcontainer-features
---> Using cache
---> 3031919254b1
Successfully built 3031919254b1
Successfully tagged jb-devcontainer-features-25e0c2226828cf635710bee8f685e786:latest
WARN[0000] /var/home/adrianherscu/Projects/basic-project/.devcontainer/selenium-hub-docker.yml: `version` is obsolete
[+] Running 1/1
! selenium-hub Warning pull access denied for jb-devcontainer-d47234a3ad8d0d053d3087b4c13e776, repository does not exist or may require 'docker login': denied: requested access to the resource is denied2.4s
[+] Building 38.8s (8/8) FINISHED docker:default
=> [selenium-hub internal] load build definition from .features.temp.doc 0.0s
=> => transferring dockerfile: 1.59kB 0.0s
=> [selenium-hub internal] load metadata for docker.io/selenium/hub:4.21 0.0s
=> [selenium-hub internal] load metadata for docker.io/library/jb-devcon 0.0s
=> [selenium-hub internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [selenium-hub] FROM docker.io/library/jb-devcontainer-features-25e0c2 0.0s
=> [selenium-hub stage-0 1/3] FROM docker.io/selenium/hub:4.21.0 0.0s
=> CACHED [selenium-hub stage-0 2/3] COPY --from=jb-devcontainer-feature 0.0s
=> ERROR [selenium-hub stage-0 3/3] RUN chmod -R 0755 /tmp/jb-devcontai 38.7s
------
> [selenium-hub stage-0 3/3] RUN chmod -R 0755 /tmp/jb-devcontainer-features/ghcr.io-devcontainers-features-java-1 && cd /tmp/jb-devcontainer-features/ghcr.io-devcontainers-features-java-1 && chmod +x ./devcontainer-feature-setup.sh && ./devcontainer-feature-setup.sh:
0.192 Installing java feature...
0.208 find: '/var/lib/apt/lists/*': No such file or directory
0.209 Running apt-get update...
0.487 Get:1 http://archive.ubuntu.com/ubuntu jammy InRelease [270 kB]
0.624 Get:2 http://security.ubuntu.com/ubuntu jammy-security InRelease [129 kB]
1.093 Get:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [128 kB]
1.288 Get:4 http://archive.ubuntu.com/ubuntu jammy/main amd64 Packages [1792 kB]
1.394 Get:5 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [1089 kB]
2.488 Get:6 https://packages.adoptium.net/artifactory/deb jammy InRelease [7504 B]
2.608 Get:7 https://packages.adoptium.net/artifactory/deb jammy/main amd64 Packages [9493 B]
2.812 Get:8 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages [1889 kB]
3.861 Get:9 http://archive.ubuntu.com/ubuntu jammy/universe amd64 Packages [17.5 MB]
29.25 Get:10 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [1389 kB]
32.24 Get:11 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [2160 kB]
34.64 Fetched 26.3 MB in 34s (765 kB/s)
34.64 Reading package lists...
35.29 Reading package lists...
35.92 Building dependency tree...
36.04 Reading state information...
36.24 findutils is already the newest version (4.8.0-1ubuntu3).
36.24 sed is already the newest version (4.8-1ubuntu2).
36.24 ca-certificates is already the newest version (20230311ubuntu0.22.04.1).
36.24 tar is already the newest version (1.34+dfsg-1ubuntu0.1.22.04.2).
36.24 unzip is already the newest version (6.0-26ubuntu3.2).
36.24 util-linux is already the newest version (2.37.2-4ubuntu3.4).
36.24 The following NEW packages will be installed:
36.24 zip
36.32 0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
36.32 Need to get 176 kB of archives.
36.32 After this operation, 544 kB of additional disk space will be used.
36.32 Ign:1 http://archive.ubuntu.com/ubuntu jammy/main amd64 zip amd64 3.0-12build2
37.62 Get:1 http://archive.ubuntu.com/ubuntu jammy/main amd64 zip amd64 3.0-12build2 [176 kB]
38.38 debconf: delaying package configuration, since apt-utils is not installed
38.40 Fetched 176 kB in 2s (87.4 kB/s)
38.41 Selecting previously unselected package zip.
38.41 (Reading database ... (Reading database ... 5%(Reading database ... 10%(Reading database ... 15%(Reading database ... 20%(Reading database ... 25%(Reading database ... 30%(Reading database ... 35%(Reading database ... 40%(Reading database ... 45%(Reading database ... 50%(Reading database ... 55%(Reading database ... 60%(Reading database ... 65%(Reading database ... 70%(Reading database ... 75%(Reading database ... 80%(Reading database ... 85%(Reading database ... 90%(Reading database ... 95%(Reading database ... 100%(Reading database ... 9150 files and directories currently installed.)
38.41 Preparing to unpack .../zip_3.0-12build2_amd64.deb ...
38.45 Unpacking zip (3.0-12build2) ...
38.50 Setting up zip (3.0-12build2) ...
38.55 usermod: user '1200' does not exist
------
failed to solve: process "/bin/sh -c chmod -R 0755 /tmp/jb-devcontainer-features/ghcr.io-devcontainers-features-java-1 && cd /tmp/jb-devcontainer-features/ghcr.io-devcontainers-features-java-1 && chmod +x ./devcontainer-feature-setup.sh && ./devcontainer-feature-setup.sh" did not complete successfully: exit code: 6
`docker-compose` process finished with exit code 17
通过 VSCode,我得到:
[39 ms] Dev Containers 0.369.0 in VS Code 1.90.0 (89de5a8d4d6205e5b11647eb6a74844ca23d2573).
[39 ms] Start: Resolving Remote
[48 ms] Start: Check Docker is running
[49 ms] Start: Run: docker version
[88 ms] Client: Docker Engine - Community
Version: 26.1.4
API version: 1.45
Go version: go1.21.11
Git commit: 5650f9b
Built: Wed Jun 5 11:31:00 2024
OS/Arch: linux/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 26.1.4
API version: 1.45 (minimum version 1.24)
Go version: go1.21.11
Git commit: de5c9cf
Built: Wed Jun 5 11:29:16 2024
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.33
GitCommit: d2d58213f83a351ca8f528a95fbd145f5654e957
runc:
Version: 1.1.12
GitCommit: v1.1.12-0-g51d5e94
docker-init:
Version: 0.19.0
GitCommit: de40ad0
[92 ms] Start: Run: docker volume ls -q
[116 ms] Start: Run: docker build -f /tmp/vsch-adrianherscu/bootstrap-image/0.369.0/bootstrap.Dockerfile -t vsc-volume-bootstrap /tmp/vsch-adrianherscu/bootstrap-image/0.369.0
[+] Building 0.8s (13/13) FINISHED docker:default
=> [internal] load build definition from bootstrap.Dockerfile 0.0s
=> => transferring dockerfile: 1.08kB 0.0s
=> [internal] load metadata for mcr.microsoft.com/devcontainers/base:0-a 0.7s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [1/8] FROM mcr.microsoft.com/devcontainers/base:0-alpine-3.16@sha256: 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 223.52kB 0.0s
=> CACHED [2/8] COPY host-ca-certificates.crt /tmp/host-ca-certificates. 0.0s
=> CACHED [3/8] RUN cat /tmp/host-ca-certificates.crt >> /etc/ssl/certs/ 0.0s
=> CACHED [4/8] RUN csplit -f /usr/local/share/ca-certificates/host-ca-c 0.0s
=> CACHED [5/8] RUN echo "@old https://dl-cdn.alpinelinux.org/alpine/v3. 0.0s
=> CACHED [6/8] RUN apk add --no-cache git-lfs nodejs python3 npm m 0.0s
=> CACHED [7/8] RUN npm config set cafile /etc/ssl/certs/ca-certificates 0.0s
=> CACHED [8/8] COPY .vscode-remote-containers /root/.vscode-remote-cont 0.0s
=> exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:451057877bfa64fc3c6088d9ded464994a3cfcfb80ddb 0.0s
=> => naming to docker.io/library/vsc-volume-bootstrap 0.0s
[1118 ms] Cloning Github repository: QA-Automation-Starter/basic-project into /workspaces/basic-project
[1118 ms] Start: Run: docker run -d --mount type=volume,src=basic-project-selenium-hub-docker-65e7d83c2f25b6574621a7d89192fd627d70def9061746e895740c734f4b6f3a,dst=/workspaces -v /var/run/docker.sock:/var/run/docker.sock vsc-volume-bootstrap sleep infinity
[1486 ms] Start: Run in container: /bin/sh
[1494 ms] Start: Launching Dev Containers helper.
[1495 ms] ssh-agent: SSH_AUTH_SOCK in container (/tmp/vscode-ssh-auth-4dccc05f-544c-4f4f-92e1-07b392422f16.sock) forwarded to local host (/run/user/1000/keyring/ssh).
[1495 ms] Start: Run in container: test -e /tmp/.X11-unix/X0
[1567 ms]
[1567 ms]
[1567 ms] Exit code 1
[1568 ms] Start: Run in container: mkdir -p '/tmp/.X11-unix'
[1569 ms]
[1569 ms]
[1569 ms] X11 forwarding: DISPLAY in container (:0) forwarded to local host (:0).
[1570 ms] Start: Run in container: gpgconf --list-dir agent-socket
[1571 ms] /root/.gnupg/S.gpg-agent
[1571 ms]
[1572 ms] Start: Run in container: gpgconf --list-dir homedir
[1573 ms] /root/.gnupg
[1573 ms]
[1573 ms] Start: Run in container: ls '/root/.gnupg/private-keys-v1.d' 2>/dev/null
[1575 ms]
[1575 ms]
[1575 ms] Exit code 2
[1575 ms] Start: Run: gpgconf --list-dir agent-extra-socket
[1581 ms] /run/user/1000/gnupg/S.gpg-agent.extra
[1581 ms]
[1581 ms] Start: Run in container: mkdir -p -m 700 '/root/.gnupg'
[1581 ms] gpg-agent: Socket in container (/root/.gnupg/S.gpg-agent) forwarded to local host (/run/user/1000/gnupg/S.gpg-agent.extra).
[1583 ms]
[1584 ms]
[1584 ms] Start: Run in container: command -v docker >/dev/null 2>&1
[1584 ms] Start: Run: gpgconf --list-dir homedir
[1587 ms]
[1588 ms]
[1588 ms] Start: Run in container: /bin/sh
[1592 ms] Start: Run in container: echo ~
[1593 ms] /var/home/adrianherscu/.gnupg
[1593 ms]
[1593 ms] Start: Run in container: gpgconf --list-dir homedir
[1595 ms] /root/.gnupg
[1595 ms]
[1598 ms] Start: Run in container: # Test for /root/.gnupg/trustdb.gpg and gpg
[1600 ms]
[1600 ms]
[1600 ms] Start: Run in container: # Copy /var/home/adrianherscu/.gnupg/trustdb.gpg to /root/.gnupg/trustdb.gpg
[1602 ms]
[1603 ms]
[1603 ms] Start: Run: gpg-connect-agent updatestartuptty /bye
[1658 ms] /root
[1658 ms]
[1658 ms] Start: Run in container: cat <<'EOF-/tmp/vscode-remote-containers-4dccc05f-544c-4f4f-92e1-07b392422f16.js' >/tmp/vscode-remote-containers-4dccc05f-544c-4f4f-92e1-07b392422f16.js
[1659 ms]
[1660 ms]
[1660 ms] Start: Run in container: cat ~/.docker/config.json || echo "{
[1662 ms] {
}
[1662 ms] cat: /root/.docker/config.json: No such file or directory
[1662 ms] Start: Run in container: mkdir -p /usr/local/bin && cat <<'EOF-/usr/local/bin/docker-credential-dev-containers-4dccc05f-544c-4f4f-92e1-07b392422f16' >/usr/local/bin/docker-credential-dev-containers-4dccc05f-544c-4f4f-92e1-07b392422f16
[1665 ms]
[1665 ms]
[1665 ms] Start: Run in container: chmod +x /usr/local/bin/docker-credential-dev-containers-4dccc05f-544c-4f4f-92e1-07b392422f16
[1666 ms]
[1666 ms]
[1667 ms] Start: Run in container: mkdir -p ~/.docker && cat <<'EOF-/usr/local/bin/docker-credential-dev-containers-4dccc05f-544c-4f4f-92e1-07b392422f16' >~/.docker/config.json
[1669 ms]
[1669 ms]
[1669 ms] Start: Run in container: cat <<'EOF-/tmp/vscode-remote-containers-server-4dccc05f-544c-4f4f-92e1-07b392422f16.js' >/tmp/vscode-remote-containers-server-4dccc05f-544c-4f4f-92e1-07b392422f16.js_1718042945791
[1672 ms]
[1672 ms]
[1674 ms] Start: Run in container: # Test for /root/.gitconfig and git
[1676 ms]
[1676 ms]
[1676 ms] Start: Run in container: # Copy /var/home/adrianherscu/.gitconfig to /root/.gitconfig
[1678 ms]
[1678 ms]
[1679 ms] Start: Run in container: # Cleaning up git config
[1683 ms]
[1684 ms]
[1684 ms] Start: Run in container: command -v git >/dev/null 2>&1 && git config --global --replace-all credential.helper '!f() { node /tmp/vscode-remote-containers-4dccc05f-544c-4f4f-92e1-07b392422f16.js git-credential-helper $*; }; f' || true
[1685 ms]
[1685 ms]
[1686 ms] Start: Run in container: # Test for /root/.ssh/known_hosts and ssh
[1688 ms]
[1688 ms]
[1688 ms] Start: Run in container: # Copy /var/home/adrianherscu/.ssh/known_hosts to /root/.ssh/known_hosts
[1690 ms]
[1690 ms]
[1779 ms] Start: Run in container: cat /workspaces/basic-project/.devcontainer/devcontainer.json 2>/dev/null
[1781 ms] Start: Run in container: cat /workspaces/basic-project/.devcontainer/devcontainer.json 2>/dev/null
[1783 ms] Start: Run in container: test -e "/var/home/adrianherscu" || (mkdir -p "$(dirname "/var/home/adrianherscu")" && ln -s ~ "/var/home/adrianherscu")
[1786 ms]
[1786 ms]
[1786 ms] Start: Run in container: docker volume ls -q
[1972 ms] Start: Run in container: docker ps -q -a --filter label=vsch.local.repository=https://github.com/QA-Automation-Starter/basic-project.git/tree/selenium-hub-docker --filter label=vsch.local.repository.volume=basic-project-selenium-hub-docker-65e7d83c2f25b6574621a7d89192fd627d70def9061746e895740c734f4b6f3a --filter label=vsch.local.repository.folder=basic-project --filter label=vsch.quality=stable
[2044 ms] Start: Run in container: docker ps -q -a --filter label=vsch.local.repository=https://github.com/QA-Automation-Starter/basic-project.git/tree/selenium-hub-docker --filter label=vsch.local.repository.volume=basic-project-selenium-hub-docker-65e7d83c2f25b6574621a7d89192fd627d70def9061746e895740c734f4b6f3a --filter label=vsch.local.repository.folder=basic-project --filter label=devcontainer.config_file=/workspaces/basic-project/.devcontainer/devcontainer.json
[2111 ms] Start: Run in container: docker ps -q -a --filter label=vsch.local.repository=https://github.com/QA-Automation-Starter/basic-project.git/tree/selenium-hub-docker --filter label=vsch.local.repository.volume=basic-project-selenium-hub-docker-65e7d83c2f25b6574621a7d89192fd627d70def9061746e895740c734f4b6f3a --filter label=vsch.local.repository.folder=basic-project
[2181 ms] Start: Run in container: docker ps -q -a --filter label=vsch.local.repository=https://github.com/QA-Automation-Starter/basic-project.git/tree/selenium-hub-docker --filter label=vsch.local.repository.volume=basic-project-selenium-hub-docker-65e7d83c2f25b6574621a7d89192fd627d70def9061746e895740c734f4b6f3a --filter label=vsch.local.repository.folder=basic-project
[2251 ms] Running Dev Containers CLI: read-configuration --workspace-folder /workspaces/basic-project --id-label vsch.local.repository=https://github.com/QA-Automation-Starter/basic-project.git/tree/selenium-hub-docker --id-label vsch.local.repository.volume=basic-project-selenium-hub-docker-65e7d83c2f25b6574621a7d89192fd627d70def9061746e895740c734f4b6f3a --id-label vsch.local.repository.folder=basic-project --id-label devcontainer.config_file=/workspaces/basic-project/.devcontainer/devcontainer.json --log-level debug --log-format json --config /workspaces/basic-project/.devcontainer/devcontainer.json --mount-workspace-git-root
[2433 ms] Start: Run in container: node /root/.vscode-remote-containers/dist/dev-containers-cli-0.369.0/dist/spec-node/devContainersSpecCLI.js read-configuration --workspace-folder /workspaces/basic-project --id-label vsch.local.repository=https://github.com/QA-Automation-Starter/basic-project.git/tree/selenium-hub-docker --id-label vsch.local.repository.volume=basic-project-selenium-hub-docker-65e7d83c2f25b6574621a7d89192fd627d70def9061746e895740c734f4b6f3a --id-label vsch.local.repository.folder=basic-project --id-label devcontainer.config_file=/workspaces/basic-project/.devcontainer/devcontainer.json --log-level debug --log-format json --config /workspaces/basic-project/.devcontainer/devcontainer.json --mount-workspace-git-root
[2818 ms] @devcontainers/cli 0.62.0. Node.js v16.20.2. linux 6.8.11-200.fc39.x86_64 x64.
[2818 ms] Start: Run: docker ps -q -a --filter label=vsch.local.repository=https://github.com/QA-Automation-Starter/basic-project.git/tree/selenium-hub-docker --filter label=vsch.local.repository.volume=basic-project-selenium-hub-docker-65e7d83c2f25b6574621a7d89192fd627d70def9061746e895740c734f4b6f3a --filter label=vsch.local.repository.folder=basic-project --filter label=devcontainer.config_file=/workspaces/basic-project/.devcontainer/devcontainer.json
[3261 ms] Running Dev Containers CLI: up --container-session-data-folder /tmp/devcontainers-e63116ea-ddc6-4ec4-9a74-b56498125b901718042943517 --workspace-folder /workspaces/basic-project --workspace-mount-consistency cached --id-label vsch.local.repository=https://github.com/QA-Automation-Starter/basic-project.git/tree/selenium-hub-docker --id-label vsch.local.repository.volume=basic-project-selenium-hub-docker-65e7d83c2f25b6574621a7d89192fd627d70def9061746e895740c734f4b6f3a --id-label vsch.local.repository.folder=basic-project --id-label devcontainer.config_file=/workspaces/basic-project/.devcontainer/devcontainer.json --log-level debug --log-format json --config /workspaces/basic-project/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=basic-project-selenium-hub-docker-65e7d83c2f25b6574621a7d89192fd627d70def9061746e895740c734f4b6f3a,target=/workspaces,external=true --mount type=volume,source=vscode,target=/vscode,external=true --mount type=bind,source=/run/user/1000/wayland-0,target=/tmp/vscode-wayland-ed67d454-343a-420c-8c8e-f42bf0afa32d.sock --skip-post-create --update-remote-user-uid-default off --mount-workspace-git-root
[3261 ms] Start: Run in container: node /root/.vscode-remote-containers/dist/dev-containers-cli-0.369.0/dist/spec-node/devContainersSpecCLI.js up --container-session-data-folder /tmp/devcontainers-e63116ea-ddc6-4ec4-9a74-b56498125b901718042943517 --workspace-folder /workspaces/basic-project --workspace-mount-consistency cached --id-label vsch.local.repository=https://github.com/QA-Automation-Starter/basic-project.git/tree/selenium-hub-docker --id-label vsch.local.repository.volume=basic-project-selenium-hub-docker-65e7d83c2f25b6574621a7d89192fd627d70def9061746e895740c734f4b6f3a --id-label vsch.local.repository.folder=basic-project --id-label devcontainer.config_file=/workspaces/basic-project/.devcontainer/devcontainer.json --log-level debug --log-format json --config /workspaces/basic-project/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=basic-project-selenium-hub-docker-65e7d83c2f25b6574621a7d89192fd627d70def9061746e895740c734f4b6f3a,target=/workspaces,external=true --mount type=volume,source=vscode,target=/vscode,external=true --mount type=bind,source=/run/user/1000/wayland-0,target=/tmp/vscode-wayland-ed67d454-343a-420c-8c8e-f42bf0afa32d.sock --skip-post-create --update-remote-user-uid-default off --mount-workspace-git-root
[3571 ms] @devcontainers/cli 0.62.0. Node.js v16.20.2. linux 6.8.11-200.fc39.x86_64 x64.
[3571 ms] Start: Run: docker buildx version
[3635 ms] github.com/docker/buildx v0.8.2 6224def4dd2c3d347eee19db595348c50d7cb491
[3635 ms]
[3636 ms] Start: Run: docker -v
[3653 ms] Start: Resolving Remote
[3893 ms] Start: Run: docker-compose version --short
[3896 ms] Start: Run: docker compose version --short
[3949 ms] Docker Compose version: 2.12.2
[3950 ms] Start: Run: docker compose -f /workspaces/basic-project/.devcontainer/selenium-hub-docker.yml --profile * config
[4003 ms] name: devcontainer
services:
chrome:
depends_on:
selenium-hub:
condition: service_started
environment:
SE_EVENT_BUS_HOST: selenium-hub
SE_EVENT_BUS_PUBLISH_PORT: "4442"
SE_EVENT_BUS_SUBSCRIBE_PORT: "4443"
VNC_NO_PASSWORD: "1"
image: selenium/node-chrome:4.21.0
networks:
default: null
ports:
- mode: ingress
target: 7900
published: "7900"
protocol: tcp
shm_size: "2147483648"
firefox:
depends_on:
selenium-hub:
condition: service_started
environment:
SE_EVENT_BUS_HOST: selenium-hub
SE_EVENT_BUS_PUBLISH_PORT: "4442"
SE_EVENT_BUS_SUBSCRIBE_PORT: "4443"
VNC_NO_PASSWORD: "1"
image: selenium/node-firefox:4.21.0
networks:
default: null
ports:
- mode: ingress
target: 7900
published: "7902"
protocol: tcp
shm_size: "2147483648"
selenium-hub:
container_name: selenium-hub
image: selenium/hub:4.21.0
networks:
default: null
ports:
- mode: ingress
target: 4442
published: "4442"
protocol: tcp
- mode: ingress
target: 4443
published: "4443"
protocol: tcp
- mode: ingress
target: 4444
published: "4444"
protocol: tcp
networks:
default:
name: devcontainer_default
[4009 ms] Start: Run: docker ps -q -a --filter label=com.docker.compose.project=basic-project_devcontainer --filter label=com.docker.compose.service=undefined
[4027 ms] Error: Service 'undefined' configured in devcontainer.json not found in Docker Compose configuration.
[4028 ms] at QtA (/root/.vscode-remote-containers/dist/dev-containers-cli-0.369.0/dist/spec-node/devContainersSpecCLI.js:429:1542)
[4028 ms] at utA (/root/.vscode-remote-containers/dist/dev-containers-cli-0.369.0/dist/spec-node/devContainersSpecCLI.js:409:3512)
[4028 ms] at processTicksAndRejections (node:internal/process/task_queues:96:5)
[4028 ms] at async KtA (/root/.vscode-remote-containers/dist/dev-containers-cli-0.369.0/dist/spec-node/devContainersSpecCLI.js:481:3865)
[4028 ms] at async eB (/root/.vscode-remote-containers/dist/dev-containers-cli-0.369.0/dist/spec-node/devContainersSpecCLI.js:481:4807)
[4028 ms] at async hrA (/root/.vscode-remote-containers/dist/dev-containers-cli-0.369.0/dist/spec-node/devContainersSpecCLI.js:661:13373)
[4028 ms] at async lrA (/root/.vscode-remote-containers/dist/dev-containers-cli-0.369.0/dist/spec-node/devContainersSpecCLI.js:661:13114)
[4035 ms] Exit code 1
[4035 ms] Start: Run: docker rm -f 3a06af2e74f87a59213b028e03ae75040e29e0c8e34c1b42b2dd1e9603c926ef
[4043 ms] Command failed: node /root/.vscode-remote-containers/dist/dev-containers-cli-0.369.0/dist/spec-node/devContainersSpecCLI.js up --container-session-data-folder /tmp/devcontainers-e63116ea-ddc6-4ec4-9a74-b56498125b901718042943517 --workspace-folder /workspaces/basic-project --workspace-mount-consistency cached --id-label vsch.local.repository=https://github.com/QA-Automation-Starter/basic-project.git/tree/selenium-hub-docker --id-label vsch.local.repository.volume=basic-project-selenium-hub-docker-65e7d83c2f25b6574621a7d89192fd627d70def9061746e895740c734f4b6f3a --id-label vsch.local.repository.folder=basic-project --id-label devcontainer.config_file=/workspaces/basic-project/.devcontainer/devcontainer.json --log-level debug --log-format json --config /workspaces/basic-project/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=basic-project-selenium-hub-docker-65e7d83c2f25b6574621a7d89192fd627d70def9061746e895740c734f4b6f3a,target=/workspaces,external=true --mount type=volume,source=vscode,target=/vscode,external=true --mount type=bind,source=/run/user/1000/wayland-0,target=/tmp/vscode-wayland-ed67d454-343a-420c-8c8e-f42bf0afa32d.sock --skip-post-create --update-remote-user-uid-default off --mount-workspace-git-root
[4043 ms] Exit code 1
[4075 ms] Container server terminated (code: 137, signal: null).
有什么建议吗? TIA, 阿德里安。
添加到撰写文件,在“服务”部分下:
tests:
image: openjdk:11
command: sleep infinity
并更改了“服务”:
"service": "tests",
删除了“构建”部分。
现在可以在 IntelliJ 中正确打开,但在 VSCode 中仍然失败。