38 lines
1.7 KiB
JSON
38 lines
1.7 KiB
JSON
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
|
// README at: https://github.com/devcontainers/templates/tree/main/src/debian
|
|
{
|
|
"name": "Debian",
|
|
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
|
|
"dockerFile": "../CubeMx/Dockerfile",
|
|
"mounts": [
|
|
// 1. Share the X11 socket for GUI display
|
|
"source=/tmp/.X11-unix,target=/tmp/.X11-unix,type=bind,consistency=cached",
|
|
|
|
// 2. Share the D-Bus system socket (resolves the system_bus_socket error)
|
|
"source=/var/run/dbus/system_bus_socket,target=/var/run/dbus/system_bus_socket,type=bind,consistency=cached",
|
|
|
|
// 3. Share .Xauthority for X11 authorization (resolves "Authorization required" error)
|
|
// Ensure the target path matches the container user's home.
|
|
"source=/run/user/1000/xauth_MASbDk,target=/home/vscode/.Xauthority,type=bind,consistency=cached"
|
|
// Make sure to adjust /home/vscode if your container user's home directory is different.
|
|
],
|
|
|
|
"containerEnv": {
|
|
// 4. Set the DISPLAY variable to use the host's X server
|
|
"DISPLAY": "${localEnv:DISPLAY}",
|
|
|
|
// 5. If using .Xauthority mount, point to its location in the container
|
|
"XAUTHORITY": "/home/vscode/.Xauthority"
|
|
},
|
|
|
|
// Optional: Command to ensure the container user owns the .Xauthority file if mounted.
|
|
// Adjust 'vscode' if your container user is different.
|
|
// "postCreateCommand": "sudo chown vscode:vscode /home/vscode/.Xauthority || echo 'Xauthority not found or permission change failed, this might be okay.'",
|
|
|
|
|
|
// Generally, avoid privileged: true.
|
|
// If you encounter permission issues that aren't solved by the above,
|
|
// adding specific capabilities is safer.
|
|
"privileged": true
|
|
|
|
} |