Workspace setting location when connecting remotely with VS Code and working on a Docker container

When I worked by connecting to the Docker container remotely from VS Code, I was in trouble because it was mounted on / every time. Looking at the devcontainer.json in the .devcontainer directory, there was a place called workspaceFolder

.devcontainer/devcontainer.json


// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.134.1/containers/docker-existing-docker-compose
// If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml.
{
	"name": "Existing Docker Compose (Extend)",

	// Update the 'dockerComposeFile' list if you have more compose files or use different names.
	// The .devcontainer/docker-compose.yml file contains any overrides you need/want to make.
	"dockerComposeFile": [
		"../docker-compose.yml",
	],

	// The 'service' property is the name of the service for the container that VS Code should
	// use. Update this value and .devcontainer/docker-compose.yml to the real service name.
	"service": "go_app",

	// The optional 'workspaceFolder' property is the path VS Code should open by default when
	// connected. This is typically a file mount in .devcontainer/docker-compose.yml
    //here
	"workspaceFolder": "/go/src/work",

	// Set *default* container specific settings.json values on container create.
	"settings": {
		"terminal.integrated.shell.linux": null
	},

	// Add the IDs of extensions you want installed when the container is created.
	"extensions": []

	// Use 'forwardPorts' to make a list of ports inside the container available locally.
	// "forwardPorts": [],

	// Uncomment the next line if you want start specific services in your Docker Compose config.
	// "runServices": [],

	// Uncomment the next line if you want to keep your containers running after VS Code shuts down.
	// "shutdownAction": "none",

	// Uncomment the next line to run commands after the container is created - for example installing curl.
	// "postCreateCommand": "apt-get update && apt-get install -y curl",

	// Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root.
	// "remoteUser": "vscode"
}

It is important to see the configuration file and read English

Recommended Posts

Workspace setting location when connecting remotely with VS Code and working on a Docker container
Create a Java (Gradle) project with VS Code and develop it on a Docker container
Create a Java (Maven) project with VS Code and develop it on a Docker container
Building a haskell environment with Docker + VS Code on Windows 10 Home
A memorandum when IME cannot be turned on with VS Code (Ubuntu 20.04)
Starting with installing Docker on EC2 and running Yellowfin in a container
Connect with VS Code from a Windows client to Docker on another server
A memorandum when installing Docker and building a Linux container
Until you build a Nuxt.js development environment with Docker and touch it with VS Code
[Docker] How to update using a container on Heroku and how to deal with Migrate Error
Run VS Code on Docker
Docker management with VS Code
Summary of steps for developing in Docker container with VS Code
I tried deploying a Docker container on Lambda with Serverless Framework
Run React on a Docker container
Run PureScript on a Docker container
Getting Started with Docker with VS Code
If the bundle install command on the Docker container ends with an error at code: 15, check the BUNDLE_PATH setting
Enable automatic html tag generation in erb when working with VS Code
[Docker] How to build when the source code is bind-mounted on the container
Monitor the Docker container and SystemD process on the same host with Zabbix on Ubuntu.
[Rails] When transitioning to a page with link_to, move to the specified location on the page
How to build a Jenkins server with a Docker container on CentOS 7 of VirtualBox and access the Jenkins server from a local PC
Experience .NET 5 with Docker and Visual Studio Code
Setting to exit from Docker container with VScode
Update container image with KUSANAGI Runs on Docker
I tried running Ansible on a Docker container
Prepare a scraping environment with Docker and Java
Try debugging a Java program with VS Code
Build a Java development environment with VS Code
What to do when booting Ubuntu on WSL2 and getting "Process terminated with code 1"
Link Docker log to AWS CloudWatch and monitor in real time with VS Code
What I was addicted to when developing a Spring Boot application with VS Code
Proceed with the official Rust documentation on a Docker container (2. Program a number guessing game)