Closed LachlanArthur closed 3 years ago
If the other services are set to share the primary service's network using network_mode: service:<primary_service>
, then the ports get forwarded correctly.
For example:
version: '3.7'
services:
php:
image: php:8-fpm
nginx:
image: nginx:1.21
+ network_mode: service:php
Log: remoteContainers
``` [2021-07-12T10:52:16.249Z] Remote-Containers 0.187.0 in VS Code 1.58.0 (2d23c42a936db1c7b3b06f918cde29561cc47cd6). [2021-07-12T10:52:16.249Z] Start: Resolving Remote [2021-07-12T10:52:16.252Z] Setting up container for folder or workspace: c:\Users\Cyykratahk\Source\vscode-dev-container-port-test [2021-07-12T10:52:16.252Z] Context: desktop-linux [2021-07-12T10:52:16.256Z] Start: Check Docker is running [2021-07-12T10:52:16.256Z] Start: Run: docker version --format {{.Server.APIVersion}} [2021-07-12T10:52:16.469Z] Stop (213 ms): Run: docker version --format {{.Server.APIVersion}} [2021-07-12T10:52:16.470Z] Server API version: 1.41 [2021-07-12T10:52:16.470Z] Stop (214 ms): Check Docker is running [2021-07-12T10:52:16.561Z] Start: Run: docker-compose version --short [2021-07-12T10:52:17.248Z] Stop (687 ms): Run: docker-compose version --short [2021-07-12T10:52:17.249Z] Start: Run: docker ps -q -a --filter label=com.docker.compose.project=vscode-dev-container-port-test_devcontainer --filter label=com.docker.compose.service=php [2021-07-12T10:52:17.441Z] Stop (192 ms): Run: docker ps -q -a --filter label=com.docker.compose.project=vscode-dev-container-port-test_devcontainer --filter label=com.docker.compose.service=php [2021-07-12T10:52:17.442Z] Start: Run: docker-compose -f c:\Users\Cyykratahk\Source\vscode-dev-container-port-test\.devcontainer\docker-compose.yml config [2021-07-12T10:52:19.249Z] Stop (1807 ms): Run: docker-compose -f c:\Users\Cyykratahk\Source\vscode-dev-container-port-test\.devcontainer\docker-compose.yml config [2021-07-12T10:52:19.249Z] services: nginx: image: nginx:1.21 php: image: php:8-fpm version: '3.7' [2021-07-12T10:52:19.249Z] [2021-07-12T10:52:19.252Z] Start: Run: docker events --format {{json .}} --filter event=start [2021-07-12T10:52:19.272Z] Start: Run: docker-compose --project-name vscode-dev-container-port-test_devcontainer -f c:\Users\Cyykratahk\Source\vscode-dev-container-port-test\.devcontainer\docker-compose.yml build [2021-07-12T10:52:19.411Z] [2021-07-12T10:52:20.033Z] php uses an image, skipping nginx uses an image, skipping [2021-07-12T10:52:20.145Z] Stop (873 ms): Run: docker-compose --project-name vscode-dev-container-port-test_devcontainer -f c:\Users\Cyykratahk\Source\vscode-dev-container-port-test\.devcontainer\docker-compose.yml build [2021-07-12T10:52:20.146Z] Start: Run: docker-compose --project-name vscode-dev-container-port-test_devcontainer -f c:\Users\Cyykratahk\Source\vscode-dev-container-port-test\.devcontainer\docker-compose.yml up -d [2021-07-12T10:52:20.268Z] [2021-07-12T10:52:20.921Z] Creating network "vscode-dev-container-port-test_devcontainer_default" with the default driver [2021-07-12T10:52:21.016Z] Creating vscode-dev-container-port-test_devcontainer_php_1 ... Creating vscode-dev-container-port-test_devcontainer_nginx_1 ... [2021-07-12T10:52:21.794Z] Stop (2542 ms): Run: docker events --format {{json .}} --filter event=start [2021-07-12T10:52:21.797Z] Creating vscode-dev-container-port-test_devcontainer_php_1 ... done Creating vscode-dev-container-port-test_devcontainer_nginx_1 ... done [2021-07-12T10:52:21.945Z] Stop (1799 ms): Run: docker-compose --project-name vscode-dev-container-port-test_devcontainer -f c:\Users\Cyykratahk\Source\vscode-dev-container-port-test\.devcontainer\docker-compose.yml up -d [2021-07-12T10:52:21.945Z] Start: Run: docker ps -q -a --filter label=com.docker.compose.project=vscode-dev-container-port-test_devcontainer --filter label=com.docker.compose.service=php [2021-07-12T10:52:22.106Z] Stop (161 ms): Run: docker ps -q -a --filter label=com.docker.compose.project=vscode-dev-container-port-test_devcontainer --filter label=com.docker.compose.service=php [2021-07-12T10:52:22.106Z] Start: Run: docker inspect --type container 9320748f08dc [2021-07-12T10:52:22.267Z] Stop (161 ms): Run: docker inspect --type container 9320748f08dc [2021-07-12T10:52:22.267Z] Start: Inspecting container [2021-07-12T10:52:22.267Z] Start: Run: docker inspect --type container 9320748f08dceb5f39d0baf30ad685fc5119f18643601865d0bb9e4fb4791a80 [2021-07-12T10:52:22.434Z] Stop (167 ms): Run: docker inspect --type container 9320748f08dceb5f39d0baf30ad685fc5119f18643601865d0bb9e4fb4791a80 [2021-07-12T10:52:22.434Z] Stop (167 ms): Inspecting container [2021-07-12T10:52:22.435Z] Start: Run in container: /bin/sh [2021-07-12T10:52:22.459Z] Start: Run in container: uname -m [2021-07-12T10:52:22.676Z] x86_64 [2021-07-12T10:52:22.677Z] [2021-07-12T10:52:22.677Z] Stop (218 ms): Run in container: uname -m [2021-07-12T10:52:22.677Z] Start: Run in container: (cat /etc/os-release || cat /usr/lib/os-release) 2>/dev/null [2021-07-12T10:52:22.680Z] PRETTY_NAME="Debian GNU/Linux 10 (buster)" NAME="Debian GNU/Linux" VERSION_ID="10" VERSION="10 (buster)" VERSION_CODENAME=buster ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/" [2021-07-12T10:52:22.680Z] [2021-07-12T10:52:22.680Z] Stop (3 ms): Run in container: (cat /etc/os-release || cat /usr/lib/os-release) 2>/dev/null [2021-07-12T10:52:22.680Z] Start: Run in container: cat /etc/passwd [2021-07-12T10:52:22.683Z] Stop (3 ms): Run in container: cat /etc/passwd [2021-07-12T10:52:22.684Z] Start: Updating configuration state [2021-07-12T10:52:22.687Z] Stop (3 ms): Updating configuration state [2021-07-12T10:52:22.687Z] Start: Setup shutdown monitor [2021-07-12T10:52:22.688Z] Forking shutdown monitor: c:\Users\Cyykratahk\.vscode\extensions\ms-vscode-remote.remote-containers-0.187.0\dist\shutdown\shutdownMonitorProcess \\.\pipe\vscode-remote-containers-982e4ff3165e3177b982f650f4069c4cbd5b6438-sock dockerCompose Debug c:\Users\Cyykratahk\AppData\Roaming\Code\logs\20210712T201907\exthost4\ms-vscode-remote.remote-containers 1626087136015 [2021-07-12T10:52:22.696Z] Stop (9 ms): Setup shutdown monitor [2021-07-12T10:52:22.697Z] Start: Run in container: test -d /root/.vscode-server [2021-07-12T10:52:22.699Z] [2021-07-12T10:52:22.699Z] [2021-07-12T10:52:22.699Z] Exit code 1 [2021-07-12T10:52:22.699Z] Stop (2 ms): Run in container: test -d /root/.vscode-server [2021-07-12T10:52:22.700Z] Start: Run in container: test -d /root/.vscode-remote [2021-07-12T10:52:22.702Z] [2021-07-12T10:52:22.702Z] [2021-07-12T10:52:22.702Z] Exit code 1 [2021-07-12T10:52:22.702Z] Stop (2 ms): Run in container: test -d /root/.vscode-remote [2021-07-12T10:52:22.702Z] Start: Run in container: test -f /var/vscode-server/.patchEtcEnvironmentMarker [2021-07-12T10:52:22.704Z] [2021-07-12T10:52:22.704Z] [2021-07-12T10:52:22.704Z] Exit code 1 [2021-07-12T10:52:22.705Z] Stop (3 ms): Run in container: test -f /var/vscode-server/.patchEtcEnvironmentMarker [2021-07-12T10:52:22.705Z] Start: Run in container: test ! -f '/var/vscode-server/.patchEtcEnvironmentMarker' && set -o noclobber && mkdir -p '/var/vscode-server' && { > '/var/vscode-server/.patchEtcEnvironmentMarker' ; } 2> /dev/null [2021-07-12T10:52:22.708Z] [2021-07-12T10:52:22.708Z] [2021-07-12T10:52:22.708Z] Stop (3 ms): Run in container: test ! -f '/var/vscode-server/.patchEtcEnvironmentMarker' && set -o noclobber && mkdir -p '/var/vscode-server' && { > '/var/vscode-server/.patchEtcEnvironmentMarker' ; } 2> /dev/null [2021-07-12T10:52:22.708Z] Start: Run in container: cat >> /etc/environment <<'etcEnvrionmentEOF' [2021-07-12T10:52:22.710Z] [2021-07-12T10:52:22.710Z] [2021-07-12T10:52:22.710Z] Stop (2 ms): Run in container: cat >> /etc/environment <<'etcEnvrionmentEOF' [2021-07-12T10:52:22.710Z] Start: Run in container: test -f /var/vscode-server/.patchEtcProfileMarker [2021-07-12T10:52:22.712Z] [2021-07-12T10:52:22.712Z] [2021-07-12T10:52:22.712Z] Exit code 1 [2021-07-12T10:52:22.712Z] Stop (2 ms): Run in container: test -f /var/vscode-server/.patchEtcProfileMarker [2021-07-12T10:52:22.713Z] Start: Run in container: test ! -f '/var/vscode-server/.patchEtcProfileMarker' && set -o noclobber && mkdir -p '/var/vscode-server' && { > '/var/vscode-server/.patchEtcProfileMarker' ; } 2> /dev/null [2021-07-12T10:52:22.715Z] [2021-07-12T10:52:22.716Z] [2021-07-12T10:52:22.716Z] Stop (3 ms): Run in container: test ! -f '/var/vscode-server/.patchEtcProfileMarker' && set -o noclobber && mkdir -p '/var/vscode-server' && { > '/var/vscode-server/.patchEtcProfileMarker' ; } 2> /dev/null [2021-07-12T10:52:22.716Z] Start: Run in container: sed -i -E 's/((^|\s)PATH=)([^\$]*)$/\1${PATH:-\3}/g' /etc/profile || true [2021-07-12T10:52:22.718Z] [2021-07-12T10:52:22.719Z] [2021-07-12T10:52:22.719Z] Stop (3 ms): Run in container: sed -i -E 's/((^|\s)PATH=)([^\$]*)$/\1${PATH:-\3}/g' /etc/profile || true [2021-07-12T10:52:22.719Z] Start: Run in container: test ! -f '/root/.vscode-server/data/Machine/.writeMachineSettingsMarker' && set -o noclobber && mkdir -p '/root/.vscode-server/data/Machine' && { > '/root/.vscode-server/data/Machine/.writeMachineSettingsMarker' ; } 2> /dev/null [2021-07-12T10:52:22.721Z] [2021-07-12T10:52:22.722Z] [2021-07-12T10:52:22.722Z] Stop (3 ms): Run in container: test ! -f '/root/.vscode-server/data/Machine/.writeMachineSettingsMarker' && set -o noclobber && mkdir -p '/root/.vscode-server/data/Machine' && { > '/root/.vscode-server/data/Machine/.writeMachineSettingsMarker' ; } 2> /dev/null [2021-07-12T10:52:22.722Z] Start: Run in container: cat /root/.vscode-server/data/Machine/settings.json [2021-07-12T10:52:22.723Z] [2021-07-12T10:52:22.723Z] cat: /root/.vscode-server/data/Machine/settings.json: No such file or directory [2021-07-12T10:52:22.724Z] Exit code 1 [2021-07-12T10:52:22.724Z] Stop (2 ms): Run in container: cat /root/.vscode-server/data/Machine/settings.json [2021-07-12T10:52:22.724Z] Start: Run in container: test -d /root/.vscode-server/bin/2d23c42a936db1c7b3b06f918cde29561cc47cd6 [2021-07-12T10:52:22.726Z] [2021-07-12T10:52:22.726Z] [2021-07-12T10:52:22.726Z] Exit code 1 [2021-07-12T10:52:22.726Z] Stop (2 ms): Run in container: test -d /root/.vscode-server/bin/2d23c42a936db1c7b3b06f918cde29561cc47cd6 [2021-07-12T10:52:22.726Z] Installing VS Code Server for commit 2d23c42a936db1c7b3b06f918cde29561cc47cd6 [2021-07-12T10:52:22.727Z] Start: Installing VS Code Server [2021-07-12T10:52:22.727Z] Start: Run in container: mkdir -p /root/.vscode-server/bin/2d23c42a936db1c7b3b06f918cde29561cc47cd6_1626087142727 [2021-07-12T10:52:22.729Z] [2021-07-12T10:52:22.730Z] [2021-07-12T10:52:22.730Z] Stop (3 ms): Run in container: mkdir -p /root/.vscode-server/bin/2d23c42a936db1c7b3b06f918cde29561cc47cd6_1626087142727 [2021-07-12T10:52:22.752Z] Start: Run in container: (dd iflag=fullblock bs=8192 count=5708 2>/dev/null; dd iflag=fullblock bs=6687 count=1 2>/dev/null) | tar --no-same-owner -xz --strip-components 1 -C /root/.vscode-server/bin/2d23c42a936db1c7b3b06f918cde29561cc47cd6_1626087142727 [2021-07-12T10:52:23.875Z] [2021-07-12T10:52:23.875Z] [2021-07-12T10:52:23.875Z] Stop (1123 ms): Run in container: (dd iflag=fullblock bs=8192 count=5708 2>/dev/null; dd iflag=fullblock bs=6687 count=1 2>/dev/null) | tar --no-same-owner -xz --strip-components 1 -C /root/.vscode-server/bin/2d23c42a936db1c7b3b06f918cde29561cc47cd6_1626087142727 [2021-07-12T10:52:23.875Z] Start: Run in container: mv -n /root/.vscode-server/bin/2d23c42a936db1c7b3b06f918cde29561cc47cd6_1626087142727 /root/.vscode-server/bin/2d23c42a936db1c7b3b06f918cde29561cc47cd6 [2021-07-12T10:52:23.878Z] [2021-07-12T10:52:23.878Z] [2021-07-12T10:52:23.878Z] Stop (3 ms): Run in container: mv -n /root/.vscode-server/bin/2d23c42a936db1c7b3b06f918cde29561cc47cd6_1626087142727 /root/.vscode-server/bin/2d23c42a936db1c7b3b06f918cde29561cc47cd6 [2021-07-12T10:52:23.878Z] Stop (1151 ms): Installing VS Code Server [2021-07-12T10:52:23.878Z] Start: Launching Remote-Containers helper. [2021-07-12T10:52:23.879Z] Start: Run: gpgconf --list-dir agent-extra-socket [2021-07-12T10:52:23.917Z] findLocalWindowsExecutable: Exectuable 'gpgconf' not found on PATH 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\libnvvp;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files\Java\jdk1.8.0_202\bin;C:\Users\Lachlan\AppData\Local\Android\android-sdk\tools;C:\Users\Lachlan\AppData\Local\Android\android-sdk\platform-tools;C:\Program Files (x86)\apache-ant-1.9.4\bin\;C:\ProgramData\chocolatey\bin;C:\Program Files\dotnet\;C:\Program Files (x86)\Nmap;C:\Program Files\Microsoft VS Code\bin;C:\tools\dart-sdk\bin;C:\Users\Cyykratahk\AppData\Roaming\nvm;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\OpenSSH;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\MKVToolNix;C:\Program Files\NVIDIA Corporation\Nsight Compute 2020.2.0\;C:\Program Files\010 Editor;C:\Program Files (x86)\dotnet\;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\HashiCorp\Vagrant\bin;C:\Users\Cyykratahk\scoop\apps\elixir\current\bin;C:\Users\Cyykratahk\scoop\apps\composer\current\home\vendor\bin;C:\Users\Cyykratahk\scoop\apps\ruby\current\bin;C:\Users\Cyykratahk\scoop\apps\ruby\current\gems\bin;C:\Users\Cyykratahk\scoop\apps\python\current\Scripts;C:\Users\Cyykratahk\scoop\apps\python\current;C:\Users\Cyykratahk\scoop\apps\yarn\current\global\node_modules\.bin;C:\Users\Cyykratahk\scoop\apps\yarn\current\Yarn\bin;C:\Users\Cyykratahk\scoop\apps\nvm\current\nodejs\nodejs;C:\Users\Cyykratahk\scoop\shims;C:\Users\Cyykratahk\.cargo\bin;C:\Users\Cyykratahk\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Lando\bin;C:\Users\Cyykratahk\AppData\Roaming\nvm;C:\Users\Cyykratahk\AppData\Local\Microsoft\WindowsApps;C:\Users\Cyykratahk\.dotnet\tools;C:\Users\Cyykratahk\AppData\Local\Programs\EmEditor;C:\Users\Cyykratahk\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Cyykratahk\AppData\Local\Keybase\'. [2021-07-12T10:52:23.919Z] Stop (40 ms): Run: gpgconf --list-dir agent-extra-socket [2021-07-12T10:52:23.919Z] Stop (41 ms): Launching Remote-Containers helper. [2021-07-12T10:52:23.920Z] userEnvProbe: loginInteractiveShell (default) [2021-07-12T10:52:23.920Z] userEnvProbe shell: /bin/bash [2021-07-12T10:52:23.920Z] Stop (41 ms): Run: gpgconf --list-dir agent-extra-socket [2021-07-12T10:52:23.921Z] Start: Run in container: cat <<'EOF-/tmp/vscode-remote-containers-33cc773106e7ef1e8a82bdd035f7daeac65408ba.js' >/tmp/vscode-remote-containers-33cc773106e7ef1e8a82bdd035f7daeac65408ba.js [2021-07-12T10:52:23.923Z] [2021-07-12T10:52:23.923Z] [2021-07-12T10:52:23.923Z] Stop (2 ms): Run in container: cat <<'EOF-/tmp/vscode-remote-containers-33cc773106e7ef1e8a82bdd035f7daeac65408ba.js' >/tmp/vscode-remote-containers-33cc773106e7ef1e8a82bdd035f7daeac65408ba.js [2021-07-12T10:52:23.923Z] Start: Run in container: # Test for /root/.ssh/known_hosts and ssh [2021-07-12T10:52:23.925Z] ssh not found [2021-07-12T10:52:23.926Z] [2021-07-12T10:52:23.926Z] Exit code 1 [2021-07-12T10:52:23.926Z] Stop (3 ms): Run in container: # Test for /root/.ssh/known_hosts and ssh [2021-07-12T10:52:23.926Z] Start: Run in container: cat <<'EOF-/tmp/vscode-remote-containers-server-33cc773106e7ef1e8a82bdd035f7daeac65408ba.js' >/tmp/vscode-remote-containers-server-33cc773106e7ef1e8a82bdd035f7daeac65408ba.js [2021-07-12T10:52:23.929Z] [2021-07-12T10:52:23.929Z] [2021-07-12T10:52:23.929Z] Stop (3 ms): Run in container: cat <<'EOF-/tmp/vscode-remote-containers-server-33cc773106e7ef1e8a82bdd035f7daeac65408ba.js' >/tmp/vscode-remote-containers-server-33cc773106e7ef1e8a82bdd035f7daeac65408ba.js [2021-07-12T10:52:23.929Z] Start: Run in container: command -v git >/dev/null 2>&1 && git config --system credential.helper '!f() { /root/.vscode-server/bin/2d23c42a936db1c7b3b06f918cde29561cc47cd6/node /tmp/vscode-remote-containers-33cc773106e7ef1e8a82bdd035f7daeac65408ba.js $*; }; f' || true [2021-07-12T10:52:23.929Z] Start: Run in container: /root/.vscode-server/bin/2d23c42a936db1c7b3b06f918cde29561cc47cd6/node /tmp/vscode-remote-containers-server-33cc773106e7ef1e8a82bdd035f7daeac65408ba.js [2021-07-12T10:52:23.931Z] [2021-07-12T10:52:23.931Z] [2021-07-12T10:52:23.931Z] Stop (2 ms): Run in container: command -v git >/dev/null 2>&1 && git config --system credential.helper '!f() { /root/.vscode-server/bin/2d23c42a936db1c7b3b06f918cde29561cc47cd6/node /tmp/vscode-remote-containers-33cc773106e7ef1e8a82bdd035f7daeac65408ba.js $*; }; f' || true [2021-07-12T10:52:23.932Z] Start: Preparing Extensions [2021-07-12T10:52:23.932Z] Start: Run in container: test ! -f '/root/.vscode-server/data/Machine/.installExtensionsMarker' && set -o noclobber && mkdir -p '/root/.vscode-server/data/Machine' && { > '/root/.vscode-server/data/Machine/.installExtensionsMarker' ; } 2> /dev/null [2021-07-12T10:52:23.935Z] [2021-07-12T10:52:23.935Z] [2021-07-12T10:52:23.936Z] Stop (4 ms): Run in container: test ! -f '/root/.vscode-server/data/Machine/.installExtensionsMarker' && set -o noclobber && mkdir -p '/root/.vscode-server/data/Machine' && { > '/root/.vscode-server/data/Machine/.installExtensionsMarker' ; } 2> /dev/null [2021-07-12T10:52:23.938Z] Extensions cache, install extensions: None [2021-07-12T10:52:23.938Z] Start: Run in container: test -d /root/.vscode-server/extensionsCache && ls /root/.vscode-server/extensionsCache || true [2021-07-12T10:52:23.940Z] [2021-07-12T10:52:23.940Z] [2021-07-12T10:52:23.940Z] Stop (2 ms): Run in container: test -d /root/.vscode-server/extensionsCache && ls /root/.vscode-server/extensionsCache || true [2021-07-12T10:52:23.941Z] Extensions cache, copy to remote: None [2021-07-12T10:52:23.941Z] Stop (9 ms): Preparing Extensions [2021-07-12T10:52:23.941Z] Start: Run in container: for pid in `cd /proc && ls -d [0-9]*`; do { echo $pid ; readlink /proc/$pid/cwd ; readlink /proc/$pid/ns/mnt ; cat /proc/$pid/stat | tr " [2021-07-12T10:52:23.969Z] Stop (28 ms): Run in container: for pid in `cd /proc && ls -d [0-9]*`; do { echo $pid ; readlink /proc/$pid/cwd ; readlink /proc/$pid/ns/mnt ; cat /proc/$pid/stat | tr " [2021-07-12T10:52:23.970Z] Start: Starting VS Code Server [2021-07-12T10:52:23.970Z] Start: Run in container: /root/.vscode-server/bin/2d23c42a936db1c7b3b06f918cde29561cc47cd6/server.sh --log debug --force-disable-user-env --port 0 --extensions-download-dir /root/.vscode-server/extensionsCache --start-server [2021-07-12T10:52:24.276Z] userEnvProbe PATHs: Probe: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' Container: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' [2021-07-12T10:52:24.282Z] * * Visual Studio Code Server * * Reminder: You may only use this software with Visual Studio family products, * as described in the license https://aka.ms/vscode-remote/license * Extension host agent listening on 46405 [2021-07-12T10:52:24.283Z] Stop (313 ms): Starting VS Code Server [2021-07-12T10:52:24.283Z] Start: Run in container: echo 46405 >'/root/.vscode-server/data/Machine/.devport-2d23c42a936db1c7b3b06f918cde29561cc47cd6' [2021-07-12T10:52:24.285Z] [2021-07-12T10:52:24.285Z] [2021-07-12T10:52:24.285Z] Stop (2 ms): Run in container: echo 46405 >'/root/.vscode-server/data/Machine/.devport-2d23c42a936db1c7b3b06f918cde29561cc47cd6' [2021-07-12T10:52:24.285Z] Port forwarding for container port 46405 starts listening on local port. [2021-07-12T10:52:24.286Z] Port forwarding local port 46405 to container port 46405 [2021-07-12T10:52:24.322Z] Start: Run in container: test ! -f '/root/.vscode-server/data/Machine/.onCreateCommandMarker' && set -o noclobber && mkdir -p '/root/.vscode-server/data/Machine' && { > '/root/.vscode-server/data/Machine/.onCreateCommandMarker' ; } 2> /dev/null [2021-07-12T10:52:24.325Z] [2021-07-12T10:52:24.325Z] [2021-07-12T10:52:24.325Z] Stop (3 ms): Run in container: test ! -f '/root/.vscode-server/data/Machine/.onCreateCommandMarker' && set -o noclobber && mkdir -p '/root/.vscode-server/data/Machine' && { > '/root/.vscode-server/data/Machine/.onCreateCommandMarker' ; } 2> /dev/null [2021-07-12T10:52:24.325Z] Start: Run in container: test ! -f '/root/.vscode-server/data/Machine/.updateContentCommandMarker' && set -o noclobber && mkdir -p '/root/.vscode-server/data/Machine' && { > '/root/.vscode-server/data/Machine/.updateContentCommandMarker' ; } 2> /dev/null [2021-07-12T10:52:24.328Z] [2021-07-12T10:52:24.328Z] [2021-07-12T10:52:24.328Z] Stop (3 ms): Run in container: test ! -f '/root/.vscode-server/data/Machine/.updateContentCommandMarker' && set -o noclobber && mkdir -p '/root/.vscode-server/data/Machine' && { > '/root/.vscode-server/data/Machine/.updateContentCommandMarker' ; } 2> /dev/null [2021-07-12T10:52:24.328Z] Start: Run in container: test ! -f '/root/.vscode-server/data/Machine/.postCreateCommandMarker' && set -o noclobber && mkdir -p '/root/.vscode-server/data/Machine' && { > '/root/.vscode-server/data/Machine/.postCreateCommandMarker' ; } 2> /dev/null [2021-07-12T10:52:24.330Z] Stop (8081 ms): Resolving Remote [2021-07-12T10:52:24.331Z] [2021-07-12T10:52:24.332Z] [2021-07-12T10:52:24.332Z] Stop (4 ms): Run in container: test ! -f '/root/.vscode-server/data/Machine/.postCreateCommandMarker' && set -o noclobber && mkdir -p '/root/.vscode-server/data/Machine' && { > '/root/.vscode-server/data/Machine/.postCreateCommandMarker' ; } 2> /dev/null [2021-07-12T10:52:24.333Z] Start: Run in container: # Test for /root/.gitconfig and git [2021-07-12T10:52:24.335Z] git not found [2021-07-12T10:52:24.336Z] [2021-07-12T10:52:24.336Z] Exit code 1 [2021-07-12T10:52:24.336Z] Stop (3 ms): Run in container: # Test for /root/.gitconfig and git [2021-07-12T10:52:24.336Z] Start: Run in container: command -v git >/dev/null 2>&1 && git config --global credential.helper '!f() { /root/.vscode-server/bin/2d23c42a936db1c7b3b06f918cde29561cc47cd6/node /tmp/vscode-remote-containers-33cc773106e7ef1e8a82bdd035f7daeac65408ba.js $*; }; f' || true [2021-07-12T10:52:24.338Z] Port forwarding connection from 64046 > 46405 > 46405 in the container. [2021-07-12T10:52:24.338Z] Start: Run in container: /root/.vscode-server/bin/2d23c42a936db1c7b3b06f918cde29561cc47cd6/node -e [2021-07-12T10:52:24.339Z] [2021-07-12T10:52:24.339Z] [2021-07-12T10:52:24.339Z] Stop (3 ms): Run in container: command -v git >/dev/null 2>&1 && git config --global credential.helper '!f() { /root/.vscode-server/bin/2d23c42a936db1c7b3b06f918cde29561cc47cd6/node /tmp/vscode-remote-containers-33cc773106e7ef1e8a82bdd035f7daeac65408ba.js $*; }; f' || true [2021-07-12T10:52:24.340Z] Start: Run in container: mkdir -p '/root/.vscode-server/data/Machine' && [ "$(cat '/root/.vscode-server/data/Machine/.postStartCommandMarker' 2>/dev/null)" != '2021-07-12T10:52:21.8814233Z' ] && echo '2021-07-12T10:52:21.8814233Z' > '/root/.vscode-server/data/Machine/.postStartCommandMarker' [2021-07-12T10:52:24.344Z] [2021-07-12T10:52:24.344Z] [2021-07-12T10:52:24.344Z] Stop (4 ms): Run in container: mkdir -p '/root/.vscode-server/data/Machine' && [ "$(cat '/root/.vscode-server/data/Machine/.postStartCommandMarker' 2>/dev/null)" != '2021-07-12T10:52:21.8814233Z' ] && echo '2021-07-12T10:52:21.8814233Z' > '/root/.vscode-server/data/Machine/.postStartCommandMarker' [2021-07-12T10:52:24.449Z] [10:52:24] Extension host agent started. [2021-07-12T10:52:24.730Z] Port forwarding connection from 64052 > 46405 > 46405 in the container. [2021-07-12T10:52:24.730Z] Start: Run in container: /root/.vscode-server/bin/2d23c42a936db1c7b3b06f918cde29561cc47cd6/node -e [2021-07-12T10:52:24.736Z] [10:52:24] [::ffff:127.0.0.1][83223bee][ManagementConnection] New connection established. [2021-07-12T10:52:25.072Z] [10:52:25] [::ffff:127.0.0.1][a25f9d9e][ExtensionHostConnection] New connection established. [2021-07-12T10:52:25.077Z] [10:52:25] [::ffff:127.0.0.1][a25f9d9e][ExtensionHostConnection] <216> Launched Extension Host Process. [2021-07-12T10:52:33.944Z] Extensions cache, remote removals: None [2021-07-12T10:52:35.372Z] Start: Run in container: cat /proc/261/environ [2021-07-12T10:52:35.376Z] Stop (4 ms): Run in container: cat /proc/261/environ [2021-07-12T10:53:33.948Z] Extensions cache, remote removals: None ```Steps to Reproduce:
service
indevcontainer.json
to the service that does not use a port. (e.g. php)forwardPorts
. (e.g. 80 for nginx)What happens:
The port is not forwarded. It seems that only the service defined in
devcontainer.json
can forward ports.Does this issue occur when you try this locally?: N/A Does this issue occur when you try this locally and all extensions are disabled?: N/A
Minimal example:
https://github.com/LachlanArthur/vscode-dev-container-port-test
devcontainer.json
```json { "name": "vscode-dev-container-port-test", "dockerComposeFile": "docker-compose.yml", "service": "php", "workspaceFolder": "/", "forwardPorts": [80], } ```docker-compose.yml
```yml version: '3.7' services: php: image: php:8-fpm nginx: image: nginx:1.21 ```