1. Starting with Docker
2. Dockerfile
3. Management in Docker
4. Docker image size reduction
5. Docker GPU passthrough
6. Docker inside Visual Studio Code
7. Docker and ROS
8. Docker Compose
9. Docker with the Jetson platform
This tutorial shows how you can create containers from images or restart/stop existing containers in Visual Studio Code. We also show you how to attach Visual Studio Code to a container, so you can develop inside of it.
The following extensions are used in this module:
- Dev Containers (Open any folder or repository inside a Docker container and take advantage of Visual Studio Code's full feature set.)
- Docker (Makes it easy to create, manage, and debug containerized applications.)
The Docker side bar can be opened using the extension icon. There you will see two important sections, the containers and the images that are currently on your system. To start a new container, right-click on one of the images and then select Run
or Run Interactive
as visible in the figure below.
Note: Interactive creates a container where you can open terminals or work in the container. If you only run a container, it will open and run some code that you specified and close again. Like the
hello-world
container in the example below. UsingRun
will only create the container which will echo hello-world and then close again. UsingRun Interactive
will be identical toRun
exept it doesn't close the container.
Existing containers can also be stopped and started from the side bar. Right-click on one of the containers that is not running (red square) and press Start
, when the container is running a green triangle will be shown.
Now that we have a running container, we can attach Visual Studio Code to it or, incase you only want a terminal interface, attach a Shell. Right-click on the running container and select Attach Shell
or Attach Visual Studio Code
. In the case of Attach Visual Studio Code
, a new Visual Studio Code window will open which will be attached to the container. This will be visible in the green lower-left corner, denoting the image name and container name. You can now open folders or open terminals inside the container and start development inside of the container.
That is all for using Docker with Visual Studio Code, for more information on docker see below for the next step.