Seth Berrier's picture

I've been using TKL images in virtualbox for years now.  I recently decided to explore running in a docker container instead.  I'm very new to docker and container virtualization so please forgive any misunderstandings there!

I tried following the official docs for running in docker to setup a TKL LAMP server:

However, once the container is up and running, I cannot connect to it at all.  Docker inspect shows a local IP address as but any attempt to connect to that returns nothing.  When I look at the status of the container in docker desktop, none of the expected ports are binding (123XX, 22, 443, and 80).

My host OS is windows 10 and I've tried both the newer WSL2 backend and the older Hyper-V one with the same result.  I also see a lot of things in the logs to the tune of "System has not been booted with systemd as init system" and I don't know if that is expected (again, I'm new to docker so maybe this is just part of how this kind of virtualization works).

I'm going to keep exploring things like windows firewall and other docker configuration issues but wanted to go ahead and ask for help here as I think I must be missing something pretty fundamental!

TIA for any help!

Seth Berrier's picture

I did find that I can expose/bind to local ports with the '-p' option from the command line (something I have messed with before).  However, this binds to localhost:port instead of allowing access through the IP of the container itself.  It works for now, but I was not expecting to have to do this and it is not quite the model I was hoping for so if there is a way to be able to access the ports directly I would prefer that.

Seth Berrier's picture

The deeper I go, it seems this is just the intended behavior for docker containers.  Direct connection from host to the container is just not possible in any practical way that I can find (although I am finding that port forwards to localhost plus remote-container connection via VS Code is really slick and gets the job done).

One other problem I'm having: none of the SSH based services seem to be running (sshd and the stunnel based ones, shellinabox and webmin).  I think this may just be because I haven't finished the initialization of the server with a proper root password, self-signed certs, and updates, but I will keep exploring and update here.

Jeremy Davis's picture

What you are reporting sounds like a networking config issue. Having said that, I have no experience with Docker on Windows so perhaps that's expected behaviour with "Docker Desktop"?! Maybe some sort of additional config is required for it to work on Windows?

I don't actually have a Windows system handy, so I can't test in a similar environment to you. I don't even have a running local Docker install running currently (personally, I'm not a huge fan). But I will hopefully check it out for you on Linux sometime soon.

It also worth noting that our Docker images are a hack (as noted in the docs) and they haven't really been maintained. If you can get them working, then they should be updateable but thought it worth mentioning.

As for the services, I can't be 100% sure, but I think you are probably right. IIRC Docker builds have a "fence" which doesn't come down until you finish the firstboot inithooks (either via pre-seeding or interactively).

Add new comment