Docker containers don't start after host reboot

Hello! I tried creating two docker containers and they’re working just fine until I log out or restart the host computer. Is there some way I can keep the containers running so I don’t have to stay logged in for things to work?

One of the containers is Jellyfin which I created using docker compose:

version: '3.8'

services:
  jellyfin:
    image: jellyfin/jellyfin:latest
    container_name: jellyfin
    ports:
      - "8096:8096"  # Web UI
      - "8920:8920"  # HTTPS (optional)
      - "1900:1900/udp"  # DLNA (optional)
      - "7359:7359/udp"  # Auto-discovery (optional)
    volumes:
      - C:\Users\Server\Desktop\Docker\jellyfin\config:/config  # Jellyfin configuration files
      - C:\Users\Server\Desktop\Docker\jellyfin\cache:/cache    # Jellyfin cache
      - V:\Media\Movies:/media/movies:ro  # Movies directory (read-only)
      - V:\Media\TV Shows:/media/tvshows:ro  # TV Shows directory (read-only)
    restart: unless-stopped
    networks:
      - jellyfin_network

networks:
  jellyfin_network:
    driver: bridge

The computer is running Windows 11 Pro and Docker Desktop with WSL.

I wanted to make an edit to this post. In an attempt to get docker to run when he host boots I created a Task Scheduler task. This didn’t work and actually breaks my docker completely. When I log into windows Docker is not running at all and I’m unable to start it manually. I have to uninstall and re install docker and recreate my containers to fix it. I tried task scheduler twice with the same result each time.

Good morning,
in the settings for Docker Desktop you can find a setting to start Docker when you login

To automatically start a container when you start Docker you can include a restart-policy as in the following docker-compose.yml-snippet

services:
  redis:
    image: redis
    restart: unless-stopped
[...]

Of course you have to recreate your container(s) afterwards with a docker compose up -d

Hope this helps? :grinning:

Hey thanks for your response! I have that option enabled and unless-stopped added to my compose file already. I think that Docker setting is referring to when you log into the computer. So I’m assuming I have to log into it and stay logged in for the containers to function. Is there a way for Docker to start without the requirement of logging in?

As statet here (Start docker desktop on windows without login) Docker Desktop is intended to be used as development environment and not as a server and therefore starting Docker Desktop without a logged in user is not supported. But it seems that some users have found a way to autologin with a user, autostart Docker Desktop and lock the screen afterwards.
With DockerCE on Linux it is no problem to start Docker without logging in as Docker is a service and therefore can be configured to start automatically.

To expand on this, if you are limited to your windows 11 machine, you could run a lightweight Linux virtual machine (which starts up at boot), pointed to your host network, to run your docker instance. This could then be configured quite easily to start your containers upon boot of the virtual machine. Hope that helps!