devcontainers / templates

Repository for Dev Container Templates that are managed by Dev Container spec maintainers. See https://github.com/devcontainers/template-starter to create your own!
https://containers.dev/templates
MIT License
955 stars 245 forks source link

"Using localhost in Docker Compose" doc can have some improvement #221

Closed chrmarti closed 8 months ago

chrmarti commented 10 months ago

doggy8088 reported in https://github.com/microsoft/vscode-remote-release/issues/7031:

I think this doc can be improved for forwardPorts description.

Here is the issue I found.

  1. I have a ASP.NET Core 6 app with a MS SQL Server database.

  2. Add .devcontainer files to the project.

    I choose C# (.NET) and MS SQL.

  3. The .devcontainer/docker-compose.yml file have the following comment.

    db:
     image: mcr.microsoft.com/mssql/server:2019-latest
     restart: unless-stopped
     environment:
       SA_PASSWORD: P@ssw0rd
       ACCEPT_EULA: Y
     # Add "forwardPorts": ["1433"] to **devcontainer.json** to forward MSSQL locally.
     # (Adding the "ports" property to this file will not forward from a Codespace.)

The Add "forwardPorts": ["1433"] to **devcontainer.json** to forward MSSQL locally. is misleading and this doc doesn't provide any details. The correct description should be Add "forwardPorts": ["db:1433"] to **devcontainer.json**.

I do find more details here. The devcontainer.json reference is really helpful. If the doc can provide a link, that will be awesome. 👍

I don't know where is the right place to create this issue. If I am creating the wrong place, please let me know. Thanks.

bamurtaugh commented 8 months ago

Kicked off a PR here: https://github.com/devcontainers/templates/pull/232