Open o1lo01ol1o opened 5 years ago
This is an issue with the setup not the container. It's trying to resolve nix-docker as a hostname so I'd look at /var/root/.ssh/configt first.
/var/root/.ssh/config
is created according to the guide with the following contents:
Host nix-docker
User root
HostName 127.0.0.1
Port 3022
IdentityFile /etc/nix/docker_rsa
Does it have the correct permissions (600) and ownership?
I believe so:
$ sudo ls -l /var/root/.ssh/
total 16
-rw------- 1 root wheel 95 May 23 15:29 config
-rw-r--r-- 1 root wheel 398 May 23 15:30 known_hosts
$ ls -l /etc/nix/
total 16
-rw------- 1 root wheel 1675 May 23 15:26 docker_rsa
I stumbled upon this issue also, a year later.
I assume that there is a domain name lookup during the test which does not respect the setting in ~/.ssh/config.
I solved it by abusing the fact that macOS does not try to resolve domain names in the .local
tld since they are reserved for Apple's Bonjour zeroconf networking (https://en.wikipedia.org/wiki/.local) and therefor naming the container nix-docker.local
instead of nix-docker
So the section in ~/.ssh/config
looks like:
Host nix-docker.local
User root
HostName 127.0.0.1
Port 3022
IdentityFile /etc/nix/docker_rsa
/etc/nix/machines
is changed likewise.
The remote builder is run as docker run --restart always --name nix-docker.local -d -p 3022:22 lnl7/nix:ssh
In hindsight, the real solution is probably to add the line 127.0.0.1 nix-docker
to the hosts file (/etc/hosts
).
I confirmed that @bxrt method of adding to /etc/hosts
works for me
adding the entry to /var/root/.ssh/config
works for me, I guess it's because nix-daemon is running as root.
I'm following the macOS-nix-docker guide here. I installed
nix-darwin
withand I've set
and
darwin-rebuild switch:
( The warning is because I have a vanilla install of nix as well and hence a
nix.conf
; maybe this would lead to the failure below?)I can ssh as root to the docker builder, but running the test build fails with
Is this an issue with the
nix-daemon
? How can I get it to talk to the docker container?