Is there anyway to have a fully configured MacOS container with ssh without using any graphical interface (no vnc)? #86

Closed
opened 2025-12-28 23:23:48 +01:00 by adam · 9 comments
Owner

Originally created by @UliPrantz on GitHub (Nov 7, 2020).

I just need a fully configured MacOS container for CI/CD is there anyway to get a container without going through the setup process in which I assume I need a vnc connection?
In other words is there a way to programmatically setup the container from the beginning? I read through the README.md and think even if I build it myself I need to connect to a vnc server once and go through the initial setup process, is it right? Would there be any way how to automate this process?

Originally created by @UliPrantz on GitHub (Nov 7, 2020). I just need a fully configured MacOS container for CI/CD is there anyway to get a container without going through the setup process in which I assume I need a vnc connection? In other words is there a way to programmatically setup the container from the beginning? I read through the README.md and think even if I build it myself I need to connect to a vnc server once and go through the initial setup process, is it right? Would there be any way how to automate this process?
adam closed this issue 2025-12-28 23:23:48 +01:00
Author
Owner

@L-U-C-K-Y commented on GitHub (Nov 8, 2020):

Check this issue, is this helping: https://github.com/sickcodes/Docker-OSX/issues/83

@L-U-C-K-Y commented on GitHub (Nov 8, 2020): Check this issue, is this helping: https://github.com/sickcodes/Docker-OSX/issues/83
Author
Owner

@UliPrantz commented on GitHub (Nov 10, 2020):

Not really I think. They consider to use the vnc version to setup the container and once it's setup they auto boot into it. But I also want this initial setup to be automated. Am I missing something? The documentation is a little bit too hard for somebody that has not much experience with virtualization, sorry.

@UliPrantz commented on GitHub (Nov 10, 2020): Not really I think. They consider to use the vnc version to setup the container and once it's setup they auto boot into it. But I also want this initial setup to be automated. Am I missing something? The documentation is a little bit too hard for somebody that has not much experience with virtualization, sorry.
Author
Owner

@iambenmitchell commented on GitHub (Nov 11, 2020):

You can setup the container and then commit it.

Then in the future run it from your commit and it will be pre set up

@iambenmitchell commented on GitHub (Nov 11, 2020): You can setup the container and then commit it. Then in the future run it from your commit and it will be pre set up
Author
Owner

@sickcodes commented on GitHub (Nov 13, 2020):

Not really I think. They consider to use the vnc version to setup the container and once it's setup they auto boot into it. But I also want this initial setup to be automated. Am I missing something? The documentation is a little bit too hard for somebody that has not much experience with virtualization, sorry.

Can't automate it, as you have to accept Apple's End User License Agreement.

Once you've accepted it, you can docker commit, and copy the .img anywhere you like. You can even import it into virt-manager.

@sickcodes commented on GitHub (Nov 13, 2020): > Not really I think. They consider to use the vnc version to setup the container and once it's setup they auto boot into it. But I also want this initial setup to be automated. Am I missing something? The documentation is a little bit too hard for somebody that has not much experience with virtualization, sorry. Can't automate it, as you have to accept Apple's End User License Agreement. Once you've accepted it, you can docker commit, and copy the .img anywhere you like. You can even import it into virt-manager.
Author
Owner

@weskerfoot commented on GitHub (Nov 24, 2020):

I did the following:

  1. Enable sshd automatically (had to use a plist file for this, otherwise it kept getting disabled)
  2. docker commit the image
  3. Call docker run with -e EXTRA="-monitor telnet::45454,server,nowait -nographic -serial null

and it works

If you wanted to automate the whole setup from scratch then it would be challenging, but I don't see the point, just create a new image and host it on docker hub yourself.

@weskerfoot commented on GitHub (Nov 24, 2020): I did the following: 1. Enable sshd automatically (had to use a plist file for this, otherwise it kept getting disabled) 2. `docker commit` the image 3. Call `docker run` with `-e EXTRA="-monitor telnet::45454,server,nowait -nographic -serial null` and it works If you wanted to automate the whole setup from scratch then it would be challenging, but I don't see the point, just create a new image and host it on docker hub yourself.
Author
Owner

@sickcodes commented on GitHub (Nov 24, 2020):

@weskerfoot great work. Do you want to submit a PR? You can add a CI/CD Solution heading to the readme if you'd like.

😎 Make sure to write "host it privately"!

As a committed image has a ton of private information ❤️

@sickcodes commented on GitHub (Nov 24, 2020): @weskerfoot great work. Do you want to submit a PR? You can add a CI/CD Solution heading to the readme if you'd like. 😎 Make sure to write "host it privately"! As a committed image has a ton of private information ❤️
Author
Owner

@sickcodes commented on GitHub (Nov 24, 2020):

The full installation automation can be done with xdotool auto-clicking but I don't encourage anyone to spend any time doing that as it's not an ideal solution.

By far the best way is to do exactly what @weskerfoot has done, docker commit your image when it's ready for spinning up and spinning down, as well as duplicating.

Mind your keys in the image!

Also you can do screenshots and things like that

docker exec container sudo pacman -Syyu scrot --noconfirm

Then you can take screenshots inside the container using scrot to see what it's up to. Alternatively, you can use this inside OSX itself, but never forget there is an X server running in the Arch base image so you can do anything as normal inside there.

@sickcodes commented on GitHub (Nov 24, 2020): The full installation automation can be done with xdotool auto-clicking but I don't encourage anyone to spend any time doing that as it's not an ideal solution. By far the best way is to do exactly what @weskerfoot has done, `docker commit` your image when it's ready for spinning up and spinning down, as well as duplicating. Mind your keys in the image! Also you can do screenshots and things like that `docker exec container sudo pacman -Syyu scrot --noconfirm` Then you can take screenshots inside the container using `scrot` to see what it's up to. Alternatively, you can use this inside OSX itself, but never forget there is an X server running in the Arch base image so you can do anything as normal inside there.
Author
Owner

@weskerfoot commented on GitHub (Nov 24, 2020):

@sickcodes

Yes, definitely make sure to use a private registry. I am using AWS ECR for this.

Also, yeah I can make a PR. Do you want me to do it as a separate Dockerfile? The plist file for starting up sshd would have to be created manually after you've installed OSX obviously. It basically amounts to using LaunchDaemon to run sudo systemsetup -setremotelogin on in a script at boot.

There is also the matter of slimming down the image after everything is set up, which you can use diskutil to do pretty easily I found

Edit: I'll just update the readme for now with the method I used

@weskerfoot commented on GitHub (Nov 24, 2020): @sickcodes Yes, definitely make sure to use a private registry. I am using AWS ECR for this. Also, yeah I can make a PR. Do you want me to do it as a separate Dockerfile? The plist file for starting up sshd would have to be created manually after you've installed OSX obviously. It basically amounts to using LaunchDaemon to run `sudo systemsetup -setremotelogin on` in a script at boot. There is also the matter of slimming down the image after everything is set up, which you can use diskutil to do pretty easily I found Edit: I'll just update the readme for now with the method I used
Author
Owner

@sickcodes commented on GitHub (Mar 7, 2021):

Added 27d7496a70

CTRL F the README for OSX_COMMANDS

@sickcodes commented on GitHub (Mar 7, 2021): Added https://github.com/sickcodes/Docker-OSX/commit/27d7496a70665ac0ead1aaf50a6417ab9dc5135c CTRL F the README for `OSX_COMMANDS`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Docker-OSX#86