Cannot pull the project from Bitbucket (the project is with IP restrictions) while using Docker with WSL2 Ubuntu-20.04 Distro - docker

I've a Symfony project that I am running on my PC with Symfony serve.
This project is on Bitbucket that has IP restrictions, I can only work from home and nowhere else for security reasons, and all works just fine :).
I wanted to create a Docker image so that I can easily change my machine and be able to deploy it elsewhere.
So I created a Docker image and did the necesseray configurations and all seems good, I can open the project and work the same way as before. The Docker has the default WSL (WSL1) and I've noticed that the application isn't running as fast as usual (outside the Docker, to load a page it would take 3 seconds, while with Docker it takes at least 30 seconds).
I did some research and found out that I could use the WSL2 with DOCKER which provides better performance than the legacy Hyper-V Backend and Enabled integration for the distro UBUNTU-20.4. The problem using the WSL2 is that I am no longer able to pull my project in the WSL2 (from the Ubuntu-20.0) because of the IP restrictions.
It is really strange that I cannot find any configuration for this and I have no idea what should I do to change it. If I pull the project outside the WLS2 distro it works, with the default WSL it works also but not with the WSL2.
I removed the IP restrcitions and the Docker image worked fine, I have the same speed as If I was outside the Docker. The only problem is that I cannot use the IP restrcitoins for this !
Does anyone know how to fix this ? I haven't been able to find any documentation for this issue.
I am using Windows 10 and the Docker version : 4.5.1 (74721)
Thanks a lot for any information.

Related

Can we debug .NET desktop apps in Docker container

(The more I dig this, the more confusing it gets. I have found Windows images available to download, but none of them appears to be the standard desktop OS)
Is there a way to debug my .NET Framework or .NET Core/5/6 desktop application (WinForms, WPF, VSTO) in a Docker container running Windows 10? I'm just trying to setup a playground environment that I could put together quickly and test my code.
For my own notes and any future beginner, here is my current finding:
Docker is not a full-fledged virtual machine like what we get with VirtualBox, VMWare etc. It's more like a process in an isolated environment, called a Container. For example you could create a container that runs an instance of MySQL, or a container that runs an instance of NodeJS. Of course there are images containing Operating System too, such as Ubuntu, Alpine or even Windows, but those images do not contain the full desktop environment; they are just the base OS services.
So answering the question, no, this is not (currently?) possible at least for Windows. People have had success running Ubuntu desktop inside a Docker container, but that is an advanced topic and only works in Linux-based containers. I haven't seen anything like that for Windows.

How to get started development inside docker container in windows operating system

I am a developer who is using Ubuntu 20.04 LTS regularly for my development. I never install any packages like, node, PHP, python in the OS and make use of docker for the purpose. VS Code is the editor I use, and the extension of the remote container will help me to develop & debug inside the docker container.
Right now, I am in the process of moving the development to a windows environment and I wanted to follow a similar workflow there too. Unfortunately, I am facing few issues like "file changes are not getting detected" (when npm serve in angular and react projects).
https://github.com/microsoft/WSL/issues/4739
https://www.reddit.com/r/bashonubuntuonwindows/comments/c48yej/wsl_2_react_not_reloading_with_file_changes/
I have tried different methods to solve the issue like
use wsl2 and then docker inside that and then serve from the container
use just docker and serve the code from inside the container
Regardless of the methods, the file changes are not getting detected inside the docker.
Trust me I have gone through many bizarre words like inotify, increasing the watchers, etc... Nothing helped.
Is there a developer out there following a similar practice in a Windows environment? (docker + windows)
Any help is highly appreciated.
I suggest moving the files to the wsl2 file system and not the windows.
Wsl2 'sees' the windows file system from inside a mount image /mnt/c .
Move out of it, like at ~ (cd ~) and i think your files will be normally watched .

How do I SSH into a container running under WSL2 from Windows without Docker for Desktop

I want to do demonstrate to the IT area at my work how one might use a container for isolated development. I have installed WSL2, then I have a development container running with some basic developer tools--OpenJDK, etc. I can SSH into the container from a WSL2 terminal simply by running ssh user#172.17.0.2, for example, but I cannot figure out how to SSH into this from Windows. More importantly, I want to be able to SSH into the running container from Visual Studio Code via Windows, but things just seem to time out. Does anybody know how to get this going? I have a very locked-down IT environment and I want to do this without having to install Docker for Windows (which I doubt my IT department will ever approve).

Problem in creating host only adapter in windows 10 docker

I am wanted to use docker toolbox but the VM is causing problems as host only network adapter is not being created.(I am new using docker toolbox and VM, plus I got two 2 VM in VMware,does this affect?)
enter image description here
I have tried rebooting after installation, running it as admin, but it still left me banging my head.
Also there is exclamation mark on host-only-network adapter in device manager and it is not visible on network connections.
Please help this poor soul.
As told within the description of the docker toolbox is a not more supported legecy project.
Maybe upgrade to Docker for Windows now?

Can I use Docker like this ...?

My work laptop is running LinuxMint as the base OS, plus Virtualbox to run Windows 7 which is the actual work environment, usually plus an additional Virtualbox VM to run a different Windows installation in which I do my client project work (I have one VM per client, to avoid messing up my main OS).
But I'm wondering if it's feasible and beneficent to switch to using Docker for the client project stuff? That is, I'd like to keep LinuxMint (to preserve my sanity), and keep Windows ('cause I have to use some MS products), but then instead of that series of "client VM's" use Docker containers?
I'm not entirely clear on how containers are useful. Can I, for instance, have a container in which I've installed dotNET and MS SQL; and then another container where I've installed an Azure Powershell; and a third container where I've installed Java and Eclipse -- and then decide which of these "sets" of software is available on the same common base OS (Windows, with VPN and Outlook and Notepad++)?
This post makes me think I'm asking for a solution from the wrong tool?
Or should I perhaps attack the root problem from a different angle, and ask the following over at Workplace.SE: How to work as a consultant without "cluttering up" one's (Windows) OS with more or less temporary installations of all sorts of software necessary for client projects?
AFAIK there is no WindowsOS ready to be run INSIDE a docker container localy, but they are anounced. See www.docker.com/microsoft and msdn windowscontainers
What you can do is run Linux OSs in docker containers within Windows. But in your case you should run the docker engine in your Mint Linux
Not really an answer, more like several comments -- though it's too long to fit within a comment
First of all I would not run Mint, but that's off the question.
Then, it may probably worth to take a look at How is Docker different from a normal virtual machine?.
Also, as you linked, Docker does not aim (at all) to run several programs. Indeed, their policy is Caas: Container as a Service. So basically one program per container. Saying all that, you can probably run wine within container and run one application on each container (over wine).
Have fun!

Resources