Is there a way in VSCode with docker extension to change docker-compose up arguments? By default it is started as docker-compose -f "docker-compose.yml" up -d --build. But I don't want to rebuild project each time. I want to run separate docker-compose build command if I need it.
I've looked over devcontainer.json parameters and working with containers article, but did not find anything useful.
Found the solution.
This can be done edditing Docker extension settings.
There is a check "Docker: Docker Compose build", which can be removed in order to disable build.
Also, settings.json can be changed with "docker.dockerComposeBuild": false parameter
Related
I installed laravel goto config extension in the remote containers and whenever I click on the link that extension generates and that should jump to another file vscode crashes and restarts
I've created the github issue with the extension creator but author doesn't have any experience with remote extensions. In the github issue I also linked github repository that you can use to reproduce the issue. Note that instead of
./vendor/bin/sail up -d --build
you can use
docker-compose up -d --build
to start the containers
Once containers start you can follow the readme or you can directly open example link below that crashes the vscode
vscode://ctf0.laravel-goto-config/var/www/html/config/app.php?name
File /var/www/html/config/app.php exists in the docker container
I don't know too much about developing vscode extensions but I managed to find out that extension uses DocumentLink and registerUriHandler under the hood to generate the link to the file and to handle incoming links. I even downloaded the extensions and tried to debug the issue, but I only managed to get the debugger and breakpoints working when using vscode directly on the host. Once I connect to remote container debugging doesn't stop on breakpoints anymore and vscode crashes when I use the vscode://... link
Is it possible to use vscode://... with remote containers to open the files?
EDIT:
I found one example where opening files trough links work. In the file .devcontainer/devcontainer.json when I hover on the files in the "dockerComposeFile": [...] list I can see the link and when I click on it it will open the file. Hovering on the link shows following value
vscode-remote://dev-container+2f55...../<absolute-path-to-file>
but this handles link with vscode and not with registerUriHandler
I managed to pinpoint the issue. In the extension there was a line
vscode.commands.executeCommand('vscode.openFolder', vscode.Uri.file(path))
that was causing vscode to reload even if it's the same folder. This only happened in remote containers
Changing this line to
vscode.commands.executeCommand('vscode.open', vscode.Uri.file(path))
solved the issue.
Command vscode.openFolder should be changed to vscode.open
I found more info about these commands in the docs
I'm using WSL 2 for Windows, and I'm currently working on a ddev repo where I am creating a development environment using ddev and VSCode. On initiation of the ddev environment, I am starting up all my containers. With my custom "ddev code" command, I am attaching VSCode to the web container via the hex representation of the web container using
'code --folder-uri="vscode-remote://attached-container+646465762d646465762d7673636f64652d646576636f6e7461696e65722d64727570616c392d74656d706c6174652d776562%/var/www/html"'
Now, I would like to automatically enable a bunch of extensions and settings. Currently, I am using workspace settings in my projects folder structure in the form of .vscode/settings.json and extension settings in the form of .vscode/extensions.json. But this is just a workaround, since VSCode will use these settings as "workspace settings" and not "devcontainer settings". I would like to define the settings and install the extensions directly on my attached VSCode container rather than in my workspace settings, since I can only use "recommendations" in the extensions.json, because it is seen as a workspace.
I know I can set the settings and extensions under "AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-containers\imageConfigs" or "nameConfigs" but I would like to have them in Ubuntu or rather in my project's folder directory. I also know that there is the devcontainer.json for standalone VSCode Containers where you can set the Docker files and settings/extensions, but how can I use such a file for my attached container?
Another way would be to install the extensions via command after attaching VSCode using
code --install-extension <extension-id>
But this will only install them locally. And executing this command in the web Container via ssh will throw an error.
Maybe someone knows a solution? If further information is needed I can of course provide it :)
Here is the repository I am working on:
https://github.com/webksde/ddev-vscode-devcontainer-drupal9-template
EDIT: Maybe this issue from our repo can also give more insight:
https://github.com/webksde/ddev-vscode-devcontainer-drupal9-template/issues/28
I am currently working with a remote docker container which is running locally on my computer, mainly Python.
I have several extensions listed on devcontainer.json so when the docker is build it install these package.
I am tryin to avoid reinstalling some of these extensions every time I rebuild or reopen the project.
Specially with Pylance and Python which require to reload the project within VScode.
Any suggestions?
Yo, put a volume over /root/.vscode-server or symlink the whole vscode server folder to a.tmp folder within the project, and then also put that folder into a persistant docker folume :)
# entrypoint.sh
echo "[Operation] Symlink vscode-server (for developers that use it)"
mkdir -p /app/.tmp/.vscode-server \
&& ln -s /app/.tmp/.vscode-server /root/.vscode-server
There is a detailed description on the official vscode docs:
[https://code.visualstudio.com/remote/advancedcontainers/avoid-extension-reinstalls][1]
This creates a docker volume on the host. The extensions will need to be installed inside the container only once because the files will be persisted on the host volume hence survive any container rebuilds.
I am using Eclipse docker tooling (version 5.1.0.202012081929). Is there any way to specify docker options, for instance -w /usr/src/mymaven or -p 8080:8080? The first example is an option missing from the dialog, while the second would help debug or override what may not be working from the dialog.
I have 5 images and try to run docker images through docker-compose up, but it is showing nothing on the console.
while running the docker-compose --version it is showing nothing.
docker-compose does not come bundled with the docker-engine. You need to install it separately after installing the engine. Follow the instructions given in this link:
https://docs.docker.com/compose/install/