I would like to autostart a docker container in the background at boot. I do not want it to start at login, but at boot (to serve a HTTP interface to all my colleagues on the LAN) before/without anyone logging in. I have tried to start the Docker App using a file in /Library/LaunchDaemons
, but it seems like the Docker App requires the user to be logged in first.
When googling, I get a lot of solutions for old VirtualBox style Docker, but I would prefer to use the official (xhyve) docker.
Running MacOS 10.12.1. Docker installed by just downloading the Docker App dmg from Stable channel.
Best Answer
?* Under construction ?
Docker for Mac is launched sandboxed (or not, if disabled in the Docker prefs) while logging in by a LogInItem in the application bundle probably using this HelperApp method.
This is the reason why neither a launch agent nor a login item (in System Preferences > User & Groups > $USER > Login Item) is available.
Probably it's very costly to impossible to launch a user owned sandboxed container & webserver image to serve the wanted HTTP interface.
Maybe it's possible by using a classical method and installing xhyve & docker-machine-driver-xhyve with homebrew instead of a VirtualBox solution and linking the boot/user Docker environment and the user Docker environment.