- Open the command palette in VS Code (CTRL+SHIFT+P).
- Select
Dev-Containers: Open Folder in Container...
and choose the project directory. - 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.
- 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/
- Build the Docker image:
docker build -t name_image .devcontainer/
- Deploy a Docker container:
docker run --rm -it -v ${PWD}:/workspaces/project_name \
-w /workspaces/project_name \
--entrypoint bash name_image:latest