Fedora container on D4W has no systemd

I have a requirement to use Fedora in production and Windows 10 for development. I spent quite awhile trying to figure out why there was no systemctl or service scripts in /etc/init.d. After a bunch of reading, I gather this is just the way it is, at least for now. Meaning, systemd won’t work on Windows hosts. Is that correct?

If so, is there an alternative upstart for services on OSes that otherwise use systemctl?

For now I’m running the app I need directly, e.g., /usr/sbin/httpd -D FOREGROUND, but it’s not elegant and makes my dev container different from our prod container.

No, this is the correct approach to for new containers. You should run the app you need directly.

To a first approximation systemd doesn’t work inside Docker containers. If you need to run, for instance, both a database and an application, run them in two separate containers, maybe using Docker Compose for orchestration. If you really need an init system then supervisord seems to be a popular choice. (I personally have never needed it, but I see several use cases described around this forum that don’t match my application.)

Here’s where I’m confused. In practice, in production, containers will run multiple services. Take something simple like ntpd or vsftpd. I have issues on windows docker in development with file sync, so I was going to run ftp on the Apache container to sync files without a mounted volume but all the docs for Fedora say to use systemctl to start the service - I don’t have access to a real Fedora machine to reverse engineer the actual run command used by systemd.

How would you run both Apache and FTP service on a container at boot without systemctl? I guess I just have to get my hands dirty and write my own entry point script, is that right?

In two separate containers, one service to a container. I’d either use the docker run --restart option or write a host-side init script to cause the two containers to launch at boot time.

I’m pretty sure all containers share the same clock (it’s managed by the kernel) so this isn’t something I’d typically run in a container. (On Windows and Mac, there’s a Linux VM, and on Mac in particular I’ve seen time sync issues reported there.)

I don’t totally understand what issue you’re trying to address. I could see a setup where you have a named data volume, attached to both FTP and an Apache containers, where the ftpd receives data and the httpd serves it. But you shouldn’t feel especially constrained to doing things exactly the way the Fedora documentation says to.

If you are specifically constrained to using Fedora and exactly following the directions in the Fedora documentation, then a Fedora-based VM will probably work better for you than trying to replicate every single Fedora service (including systemd, which has some significant design problems for use inside Docker) inside a Docker container.

Your responses have been helpful.

I set out with the idea that one of the best things about docker is that you can use it to configure and manage servers in any environment using the same exact configuration. It’s clear to me now that theory is faulty; this isn’t possible on every host platform and every container type.

You can come close though, and I guess there probably isn’t a huge need for the containers to be exact across environments anyhow, as long as they’re reliable and close enough to be useful.

Sadly, I just learned our company will not support Docker in production anyway, so I really just need to get a stable environment I can use for development and staging.

Thanks for the replies.