VSCode in-container-debugging over SSH machine - docker

I am trying to setup and advanced configuration with VScode insider and I ma facing an issue.
My setup is:
VSCode Running in my local machine Windows 10 with a Django source code hosted on my machine. I have no docker client on this machine, and I don't wont to install one...
A virtual machine with Ubuntu is running a docker daemon, docker client and docker-compose. My workspace is shared over vboxfs and mounted on my Ubuntu
A python docker container is running in the Ubuntu machine and running the mounted code.
I tried to use the Remote Extension to debug the python code inside the container. However, when a run my vscode inside on the remote SSH Taget (so the ubuntu machine), I am able to manage docker objects (images, containers, etc...) using the Docker extension of vscode, but I can't see the option: Remote-Containers: Open Folder in Container. It's not found in the F1 command... I can see the other related command like: Remote-Containers: Settings.
Do you have any idea ? Or my setup is not supported by the extension ? It seems like it supports SSH development or Container development but not mixing both together, right ?
Is there any other VSCode config to debug in my targeted setup ?
Regards

Related

Develop on Docker container from Intellij

How can develop on my Docker container from Intellij? I am developing on macOS, but my development environment is inside a Docker container. In VSCode, I can use the Remote - Containers extension to open the files in my Docker container, go to function definitions, use the version of Go on the container, access the container shell--it's as if I am accessing a remote machine from VSCode. I didn't have to change my Dockerfile or mount any volumes. Everything just worked.
IntelliJ seems to have added something according to this, but the total functionality is unclear. I can attach to a running container using the Docker plugin, access the shell, and inspect the container's attributes, but none of the above other functionality with VSCode.
Here are some examples of why this is needed:
I am developing on macOS, but my target is specific to Intel Linux code. If I do Cmd+B on a symbol, I'm taken to a Darwin specific file
importing github.com/docker/libnetwork fails because the files in this package can only be built for Linux
The above doesn't happen on VSCode because I can develop directly on the container.

Unable to connect with Xdebug from a Docker container inside and WSL2 instance

I have to do PHP development, for this I was given an Windows 10 machine, this is something I cannot change. So I use the WSL2 feature to setup and development server using Ubuntu 20.04.
First attempt:
Used Windows with Docker Desktop. I configured the environment but was had issues. The mapping between of the project volume and Docker caused important processed like Composer, git etc to be very slow. So this is considered unworkable for me.
Second attempt:
Setup a development environment directly in the WSL2 instance. This works. I'm able to connect with the Xdebug debugger using PhpStorm. But again the rest of the operations are very slow and is considered unworkable for me.
Third attempt:
I was advised to do the following: Create WSL2 Ubuntu 20.04 instance. Install docker on it and store the project folder directly in \\wsl$. In this WSL2 instance I run a docker webserver container. The webserver becomes accessible by localhost.
This seems to work very good, not sure why though... The websites running on the docker webserver are very fast and executing git or composer commands are fast. I open the project folder directly from the \\wsl$ location with PhpStorm.
The only issue I'm having is that I'm unable to create Xdebug session using PhpStorm.
My question is: How to configure the development environment so I can use Xdebug?
Facts & specs
Windows 10 as host machine.
WSL instance: Ubuntu 20.04
Docker webserver instance: Ubuntu 20.04 (php7.4-fmp and apache2, xdebug 3.0.3 port 9000)
The docker webserver container can access the host network (192.x.x.x.)
The docker webserver container can access the WSL network (172.20.x.x)
I use the following xdebug settings:
xdebug.mode = debug
xdebug.client_host = host.docker.internal (this goes to the 192.x.x. address)
Any advise on how to make Xdebug work in this setup?

VSCode cannot access Docker image inside wsl2 image

I am running a cuda enabled docker container inside wsl2 and when i try to use VSCode to run scripts inside it i cannot connect to it. The message in the docker plugin window is:
Error: connect EACCESS /var/run/docker.sock
I added the default user in the wsl to the docker group. I double-checked and i know for sure that i can run docker as a user. How do I elevate the VSCode privillages to make it able to access the docker inside the wsl image?
Btw. I cannot use docker desktop because it does not allow to use the gpu inside the container.
UPDATE
So with the set of plugins locally:Docker, Remote - WSL, Remote - Containers, Remote SSH, Remote Development, Remote SSH - editing configuration files
in the WSL: Docker Explorer, Docker, Docker Extension Pack
I am able to log from VSCode directly to the console and perform other basic operations (starting containers etc). Attaching VSCode is still impossible as for now. At least the menu option under RMB throws an error

pycharm on windows and docker in linux vm

By any chance can Pycharm on Windows be configured to run docker inside a linux VM (VirtualBox) ?
Meaning that i would like to take advantage of the Pycharm Docker tools of professional version but avoid installing docker for windows, since im using Linux VMs that have Docker installed.
Tried to set the tcp://xx.xx.xx.xx:2375 of the guest host vm but failing. Not sure if this can be done at all.
There's no native support, but you can configure PyCharm to work with remote Docker daemon. Basically you need a deployment configuration alongside the Docker-based remote interpreter to transfer the project files to remote machine where they can be mounted inside a container.
See the detailed instruction in PyCharm's bug tracker https://youtrack.jetbrains.com/issue/PY-33489 and please vote for the ticket if you want this support to be a first-class citizen in PyCharm.

Using commands in bluemix user interface

I need to use docker container in bluemix but my laptop does not support docker so I can't use the commands to run docker in bluemix using the CLI plug-ins.
Is there any other way to do this?
Why can't you run it on your laptop? Docker can run in some flavor on most operating systems (albeit within a VM on some).
You have a number of options though:
Run it inside a linux virtual machine locally
Run it inside a cloud linux virtual machine
Run it inside a cloud container - Yes, you can actually run Docker inside a Docker container.
Install a linux OS as a dual boot option on your laptop and run Docker there.
Edit: formatting
which OS does your notebook run?
Docker supports Linux, OSX and Windows as well, and you could choose to use cf container plugin (cf ic), docker or also ice client.
Here you could find Bluemix documentation related to container

Resources