Skip to content

Local Containers #19502

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 88 commits into from
Jun 9, 2025
Merged

Local Containers #19502

merged 88 commits into from
Jun 9, 2025

Conversation

laurenastrid1
Copy link
Contributor

@laurenastrid1 laurenastrid1 commented May 28, 2025

Pull Request Tmplate – vscode-mssql

Description

Scenarios

  • User tries to make a new Docker container, and Docker is not installed. The extension prompts the user to install Docker.
    dockerNotInstalledError

  • User tries to make a new Docker container, and Docker is not started. The extension then attempts to start Docker.
    startDockerForUser

  • User tries to make a new Docker container, but something is wrong with the engine (e.g., Windows containers, no user privilege to run Docker engine commands on Linux, Rosetta not enabled on Mac). On Windows platforms, the extension will prompt the user to switch to linux containers; if they accept the prompt, then the extension will switch to linux containers for them. On Linux and Mac, the extension will notify the user what the problem with the engine is.
    promptUserForLinuxEngineSwitch

  • User makes a new Docker container without a custom container name or port. The extension will use the default name of the container, which will be sql_server_container_{number}, and use the default port for container, which will be the next available port beginning at 1433
    createDefaultContainer

  • User makes a new Docker container with a custom container name and port. If the user tries to use a port/container name already in use, they will be prompted for a unique input.
    createCustomContainer

  • User adds a Docker container through the connection dialog, and the extension detects that it's a Docker container.
    autoDetectDockerContainer

  • User starts Docker container through the extension.
    startContainer

  • User stops Docker container through the extension.
    stopContainer

  • User deletes Docker container through the extension.
    deleteContainre

Test Coverage:
image

Code Changes Checklist

  • New or updated unit tests added
  • All existing tests pass (npm run test)
  • Code follows contributing guidelines
  • Telemetry/logging updated if relevant
  • No regressions or UX breakage

Reviewers: Please read our reviewer guidelines

@laurenastrid1
Copy link
Contributor Author

A few questions on the prerequisite checks page,

  1. looks like we are checking all 3 prerequisite of them concurrently. Should we do them sequentially / pretend to do them sequentially and fail at the first error?
  2. Can we auto-expand the first error during the checks?
  1. It is checking sequentially! It checks which step is the next step that isn't started yet, and runs that.
  2. Just implemented! Check out the first gif in the pr :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: These icons look more like the server icon. Maybe we can use better icons. Something like this with +sign.
eeab (1)

@laurenastrid1 laurenastrid1 force-pushed the laurennat/localContainers branch from 3d2a07a to 59fceb8 Compare June 6, 2025 17:48
return sanitized;
}

/**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: add link to the password policy.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const containerIds = stdout.split("\n").filter(Boolean);
if (!containerIds.length) return startPort;

const usedPorts = await getUsedPortsFromContainers(containerIds);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: what if the port is used by something other than docker.

// doing it this way instead of directly calling startContainer
// allows for the object explorer item loading UI to show
this._objectExplorerProvider.deleteChildrenCache(node);
await this._objectExplorerProvider.setNodeLoading(node);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: Maybe this code should have been added in OE service so that we can keep track of everything in one place.

Copy link
Contributor

@aasimkhan30 aasimkhan30 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While there are many improvements that can be made to the code, this looks good to me for the initial checkin. Please test and make sure everything is working before doing the merge.

@aasimkhan30 aasimkhan30 merged commit 61ef8bf into main Jun 9, 2025
5 checks passed
@aasimkhan30 aasimkhan30 deleted the laurennat/localContainers branch June 9, 2025 17:00
@laurenastrid1
Copy link
Contributor Author

@aasimkhan30 merged it in for me because of my github permissions bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants