Elastic beat not working if installed as docker container - docker

I can install beat service manually as windows services (services.msc). When I tried to install as docker image(https://www.elastic.co/guide/en/beats/metricbeat/current/running-on-docker.html), system module (host machine data), iis module (from host machine ) etc are not working. My host Machine is Windows

Related

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?

Can I run window and linux containers at the same time? Docker

I have a zendframework 2 website that need a linux OS, and the website use a search engine that run on windows OS (IIS). How to use docker to run the website and the search engine at the same time?
Iam new to docker, I will appreciate if someone can help with docker-compose.yml and Dockerfile.
Docker uses the kernel in the system that you are using on the host machine to run the container, so if you have a linux machine with docker installed you can only run images of containers that uses a linux kernerl.
So you can't have a windows container on a linux machine.
Also this can help

WSL2 lan redirection issue when Docker installed

My current setup is my laptop and desktop, they're connected in the same network. I do webdev so i code in my laptop and see the results in my desktop's browser. After installing docker i can no longer access my laptop's web servers that are being runned inside WSL2 directly, ONLY if they're running inside a Docker container.
This issue wasn't present in WSL1, which is:
If you install docker desktop on your windows machine and enable the new WSL2 integration it will mess your windows 'hosts' file (found at %SYSTEMROOT%\System32\drivers\etc\hosts)
Docker automatically adds the following:
# Added by Docker Desktop
192.168.1.77 host.docker.internal
192.168.1.77 gateway.docker.internal
# To allow the same kube context to work on the host and the container:
127.0.0.1 kubernetes.docker.internal
Note that 192.168.1.77 is my laptop static IP which i set in my router
My guess is that these inputs are redirecting my desktop's requests to docker, completely breaking directly access.
This is not ideal because i have to build a container for coding a simple react app which leads to alot of useless complexity
ps: I have tried the following entries in hosts file, no success:
192.168.1.77 localhost
also:
172.22.3.92 ubuntu.wsl # managed by wsl2-host (service that creates a hostname for WSL2 ip)
192.168.1.77 ubuntu.wsl
The only workaround is to disable docker and clean hosts file, which isn't really what it suposed to be.
Add this to ~/.wslconfig (win) or /etc/wsl.conf (wsl)
[network]
generateHosts = false

VSCode in-container-debugging over SSH machine

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

Install docker parallel to LAMP

I think about installing a docker system on my local test server with ubuntu 16.04. I already installed lamp with many test applications.
Can I use docker with mysql, apache and php parallel on the same server without compromising the already installed and used system or do i have to set up a virtual box system before?
You can definitely install Docker with all the lamp stack as containers, and that will not affect the already running apps.
You will only have to remap the docker container ports to custom ports
(ex: apache 80->8080)

Resources