I believe that programmers are already proficient at opening the IDE and typing codes on their computers. Installing java sdk and nodejs on the computer, these basic operations are also proficient enough to burst, but have you ever imagined migrating the development environment? into the container? Or code the development environment? You only need to install the IDE on your computer, connect it to the container, and you can develop and compile immediately. Does it sound a little exciting?
Recently, Microsoft released a set of
Remote-Development. It allows developers to
VSCodeDirectly access the remote directory for development work. In this way, our code and development environment can be separated from the terminal computer, which can avoid pollution to the local environment, and can freely set up multiple different development environments at the remote end to switch at any time. Combined with container technology, different development environments can be effectively integrated Carry out segmentation, and use containers as units to copy and migrate, and even package and distribute the same environmental requirements within the group. Newly recruited students do not need to build an environment, and can directly enter the development by connecting to the container. Let me lead you to build such a remote development environment from shallow to deep.
The so-called pit warning means that I will explain all the big and small pits I have walked through here at the beginning of the article, so that everyone can have a psychological expectation first… After all, in this world, apart from pits, there are only pits. Fucked (cover face).
Remote-ContainersMany of the current functions of this set of plug-ins are based onlocal computerInstalled
dockercontainer environment, although it supports connecting to remote
dockerContainer, but after connecting to the remote end, there will be a lot of additional settings that need to be done…
- If you still need to compile the docker image function in your development environment (for example, if you want to compile
nativemirror image. Don’t ask, I’m still in the pit and can’t get out…), there will be more messy and exotic beast-level errors. Of course, if only by
warIt can be done easily with the package.
prepare the environment
A total of the following tools are required:
Docker CLI(Because the plug-in needs to use the native docker command)
Notice: Here I will separate two scenarios to illustrate:
[local]: Represents that the docker environment is directly installed on the local computer.
[remote]: Indicates that the docker environment is installed on the remote server.
1. Install VSCode
own motherdownload linkGo ~ Skip!
2. Install the plugin
Ctrl+Shift+XOpen the plug-in interface, search
Remote DevelopmentJust install it.
3. Install docker
[local]If you want to install directly to your local computer and use the local docker environment, then installdocker desktopAfter installation, there will be a docker environment locally.
[remote]If you don’t want to install it locally and want to link to the docker on the remote server, you can install docker-cli. (Of course, there are the most pits…)
- downloaddocker.exe, put in
PATHpath, so that the command line can be used directly
power shellfight inside
docker infoCommand, see something come out on it.
[remote]Enable the docker remote call api function[](#reference article)
Run the following command to create
override.conffile, then reboot
dockerJust the process.
# create folder $ sudo mkdir /etc/systemd/system/docker.service.d/ # create conf file $ sudo vi /etc/systemd/system/docker.service.d/override.conf # Add the following content to override.conf [Service] ExecStart= ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2375 --containerd=/run/containerd/containerd.sock
tcp://0.0.0.0:2375The port number can be modified according to your needs.
[remote]set VSCode[](#reference article)
Yes, if you connect to the remote docker, you need to set the following things, yeah~
Open it in vscode
docker host, fill in the remote
dockerthe address of:
have a test
After all settings are complete, click on the
Remote Explorer, if you can see the docker container information, spicy is success.
Let us learn together, progress together, and be bald together~
Welcome to pay attention to my personal public number! Private message me on the official account and I will reply in seconds~