Skip to content

Instantly share code, notes, and snippets.

@yohhaan
Last active March 28, 2024 19:09
Show Gist options
  • Save yohhaan/b492e165b77a84d9f8299038d21ae2c9 to your computer and use it in GitHub Desktop.
Save yohhaan/b492e165b77a84d9f8299038d21ae2c9 to your computer and use it in GitHub Desktop.
How to use VS Code Remote Containers Extension

VS Code Integration

Requirements

Setup

  1. Open the command palette in VS Code (CTRL+SHIFT+P).
  2. Select Dev-Containers: Open Folder in Container... and choose the project directory.
  3. VS Code deploys the container and mounts the project directory as a volume automatically. Just open a terminal in VS Code (CTRL+SHIFT+`) to run commands.

Miscellaneous

  • To rebuild the image, open the command palette (CTRL+SHIFT+P), and select Dev-Containers: Rebuild and reopen in container
  • You can customize VS Code settings through a devcontainer.json file under .devcontainer/

To Manually Deploy the Docker Container

Requirement

Commands

  1. Build the Docker image:
docker build -t name_image .devcontainer/
  1. Deploy a Docker container:
docker run --rm -it -v ${PWD}:/workspaces/project_name \
    -w /workspaces/project_name \
    --entrypoint bash name_image:latest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment