Open maxlapides opened 2 years ago
Not sure if this is helpful, but this is what I'm seeing!
-e "OSX_COMMANDS=/bin/bash -c \"pwd && uname -a\"" \
Is a demo command, you can change it to something else:
-e "OSX_COMMANDS=/bin/bash -c \"echo hello\""
The container will delete itself after running the commands, or you can remove that line
The container will delete itself after running the commands, or you can remove that line
I think this is where I'm a bit confused. Here's what I just ran:
docker run -it \
--device /dev/kvm \
-p 50922:10022 \
-e GENERATE_UNIQUE=true \
-e NOPICKER=true \
-e MASTER_PLIST_URL=https://raw.githubusercontent.com/sickcodes/Docker-OSX/master/custom/config-nopicker-custom.plist \
-e IMAGE_PATH=/home/arch/OSX-KVM/mac_hdd_ng.img \
-e "OSX_COMMANDS=/bin/bash -c \"echo hello\"" \
mycontainer
And here's the result:
It never terminates, and I never see "hello" logged. I feel like I'm so so close to having this working!
My container will only work in full auto with the OSX_COMMANDS if you make the user account arch
and the password alpine
.
Try that and you can use the full auto version, but you'll also need to build using the Dockerfile.auto
Okay I read through the Dockerfile.auto
and I think I understand better now. In the above example, OSX_COMMANDS isn't working because I'm building my Docker image from :naked
. Thanks for that tip!
FROM sickcodes/docker-osx:naked
USER arch
COPY --chown=arch ./deduped /image/mac_hdd_ng.img
So, now I'm trying a different approach where I run my docker-osx container by itself and then have my CI tasks SSH into that container to run various scripts. Locally, I am testing out SSH first by running this:
docker run -it \
--device /dev/kvm \
-p 50922:10022 \
-e GENERATE_UNIQUE=true \
-e NOPICKER=true \
-e IMAGE_PATH=/image/mac_hdd_ng.img \
mydockerosximage
And then after that starts up, outside of the container I can run:
sshpass -pmypassword ssh -o StrictHostKeyChecking=no myuser@127.0.0.1 -p 50922 'uname -a'
And that works!
I can also run:
docker exec [MY_CONTAINER_ID] sshpass -pmypassword ssh -o StrictHostKeyChecking=no myuser@127.0.0.1 -p 10022 'uname -a'
This also works 😄
So next I configured my Kubernetes-based CI system to use a readinessProbe
to determine whether macOS is ready:
readinessProbe:
exec:
command: ["sshpass", "-pmypassword", "ssh", "-o", "StrictHostKeyChecking=no", "myuser@127.0.0.1", "-p", "10022", "'uname -a'"]
I also configured all the same environment variables:
env:
- name: NOPICKER
value: 'true'
- name: GENERATE_UNIQUE
value: 'true'
- name: IMAGE_PATH
value: '/image/mac_hdd_ng.img'
As expected, the probe fails until macOS is ready. It sends this error:
Readiness probe failed: ssh: connect to host 127.0.0.1 port 10022: Connection refused
But ultimately, the probe starts returning a different error:
Readiness probe failed: kex_exchange_identification: read: Connection reset by peer Connection reset by 127.0.0.1 port 10022
And that's where I'm currently stuck! This may be a configuration mistake in my CI system, but I'm not sure right now. Any ideas are welcome :)
Oh one more potentially useful clue, the logs for the docker-osx container end like this:
alsa: Could not initialize ADC
alsa: Failed to open `default':
alsa: Reason: No such file or directory
ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
ALSA lib conf.c:5111:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
ALSA lib conf.c:5111:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
ALSA lib conf.c:5111:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5599:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM default
alsa: Could not initialize ADC
alsa: Failed to open `default':
alsa: Reason: No such file or directory
audio: Failed to create voice `adc'
qemu-system-x86_64: Slirp: Failed to send packet, ret: -1
qemu-system-x86_64: Slirp: Failed to send packet, ret: -1
qemu-system-x86_64: Slirp: Failed to send packet, ret: -1
qemu-system-x86_64: Slirp: Failed to send packet, ret: -1
qemu-system-x86_64: Slirp: Failed to send packet, ret: -1
qemu-system-x86_64: Slirp: Failed to send packet, ret: -1
qemu-system-x86_64: Slirp: Failed to send packet, ret: -1
qemu-system-x86_64: Slirp: Failed to send packet, ret: -1
qemu-system-x86_64: Slirp: Failed to send packet, ret: -1
qemu-system-x86_64: Slirp: Failed to send packet, ret: -1
qemu-system-x86_64: Slirp: Failed to send packet, ret: -1
Remove OSX_COMMANDS to get a shell, only in :auto
Example: https://github.com/sickcodes/Docker-OSX#prebuilt-image-with-arbitrary-command-line-arguments
@maxlapides Did you end up running it for CICD pipelines , if you please share any heads up
@Eslam-mohammed-anwar I did eventually figure out the issue here. The root cause is that the readiness probe that I wrote is no good.
OS related issued, please help us identify the issue by posting the output of this
Hey there! This is an awesome project. I've successfully created a deduped.img file following the CI/CD instructions.
I am now trying to use this .img file to run my Xcode build. So, here's what I'm running:
This results in a
(qemu)
command prompt, but I'm not sure what to do with that. I thought theOSX_COMMANDS
would be run and output, but that doesn't seem to happen here. Do you have any recommendations on what my next steps should be?Thanks again! Really appreciate the work on this!