New to docker containers

Hi there,

I’m currently trying to understand how docker can help me in my daily work. I’m using it on windows and I’ve understand the concept (a container is just a linux process with a bit more isolation than a classic process). Let’s take an easy example: i would like to run some networking tool that scans my machine ports ! When I run the busybox image and scan the ports, I’m scanning the the container itself (nothing run in that container). Now, I wanted to scan the ports on my windows machine instead. I know that with docker, you can map ports, volumes but how can I fix this simple scenario ? Thanks

Please define what you mean by “scanning ports”. Port scanning of a remote machine doesn’t make sense locally, so you wouldn’t scan the ports of a container.

If you want to run something locally on the host, I don’t think you are looking for containers, especially not Linux containers. Linux containers on Windows will run inside a virtual machine so there is no way to do anything with the network of the actual host machine. You could run Windows containers with --isolation process but doesn’t let you run

Port mapping is for making a web service or website available from outside of your host machine or in case of Docker Desktop, outside of the virtual machine.

Hi rimelek,

Port scanning was juste an example. Let’s say that i wanted to use a linux tool (on windows) without spinning up a linux vm. I would launch a docker container with a minimal linux os (like the busybox one). I know what is the use case of containers but Im just trying to see how I can use it in combination with my windows host (please don’t speak about WSL because even there, I’m not isolated and can break things on my host machine).

How could you break something on your host machine? By the way Docker Desktop uses WSL2 by default which is a virtual machine so you can’t do it without a VM. WSL2 at least just a light-weight, special VM, although there are reports about using too much memory, but I have never experienced that during the period I run it usually. If you don’t use WSL2 as a backend, then the other option is Hyper-V so you will always have a virtual machine. If you run multiple WSL2 distributions, you are isolated. Only the kernel will be common, but that wouldn’t be different with containers as they “use” the kernel of the host.

WSL 1 was indeed different and that was not a virtual machine, but WSL 2, which is required by Docker Desktop (or HyperV) is a VM. One common kernel and multiple isolated distributions.

I like containers and Docker, so I don’t want to talk you out of it, but if you just want to run some linux commands occasionally, running Docker Desktop is just not necessary on Windows. If you want to create reproducable, small (a few processes) environments or actively destroy and recreate different kind of Linux distributions like Alpine, Ubuntu, Debian, Centos, or using specific container based applications, then using Docker could be better then just WSL 2.