Help getting remote building of docker images on macOS please

I’ve tried following the instructions at GitHub - LnL7/nix-docker: Docker images for the Nix package manager.

I’ve actually used GitHub - holidaycheck/nix-remote-builder: Easy way to set up a linux remote builder in docker (forked to GitHub - ldeck/nix-remote-builder: Easy way to set up a linux remote builder in docker) which does the same thing via script to setup nix-docker as a remote builder.

When I attempt to create a build that appears to succeed but I then get this error when loading the image into docker:

 % docker load < result                                                                                                             
error during connect: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.41/images/load?quiet=0: read /dev/stdin: is a directory

What have I missed?

Build details below…

% cat ~/.nix/remote-build-env 
#!/usr/bin/env bash

mkdir -p /tmp/nix/current-load
chmod a+rwX /tmp/nix/current-load

export NIX_BUILD_HOOK="${HOME}/.nix-profile/libexec/nix/"
export NIX_REMOTE_SYSTEMS="${HOME}/.nix/remote-systems.conf"
export NIX_CURRENT_LOAD="/tmp/nix/current-load"
% source ~/.nix/remote-build-env 
% nix-build -E 'with import <nixpkgs> { system = "x86_64-linux"; }; hello.overrideAttrs (drv: { REBUILD = builtins.currentTime; })'
these derivations will be built:
building '/nix/store/81yrnrb8fgzszn34z8fw25px3ilx0gyh-hello-2.10.drv' on 'ssh://nix-docker'...
Warning: Identity file /etc/nix/docker_rsa not accessible: No such file or directory.
agent key RSA SHA256:mOoSGVOxYNmdMVOiCw3ONAyQOfTZS9k+4rzKehPLYi8 returned incorrect signature type
unpacking sources
unpacking source archive /nix/store/3x7dwzq014bblazs7kq20p9hyzz0qh8g-hello-2.10.tar.gz
source root is hello-2.10
setting SOURCE_DATE_EPOCH to timestamp 1416139241 of file hello-2.10/ChangeLog
patching sources
configure flags: --disable-dependency-tracking --prefix=/nix/store/h8fhglmkzgnj4kwk308ifyfvxqynjs90-hello-2.10
checking for a BSD-compatible install... /nix/store/485sqh570qixsv9wk0d59vrvs35pqja0-coreutils-8.32/bin/install -c
make[3]: Leaving directory '/tmp/nix-build-hello-2.10.drv-0/hello-2.10'
make[2]: Leaving directory '/tmp/nix-build-hello-2.10.drv-0/hello-2.10'
make[1]: Leaving directory '/tmp/nix-build-hello-2.10.drv-0/hello-2.10'
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/h8fhglmkzgnj4kwk308ifyfvxqynjs90-hello-2.10
shrinking /nix/store/h8fhglmkzgnj4kwk308ifyfvxqynjs90-hello-2.10/bin/hello
gzipping man pages under /nix/store/h8fhglmkzgnj4kwk308ifyfvxqynjs90-hello-2.10/share/man/
strip is /nix/store/fx4kvd2440kgrq73irdkmwqf6vvzwf2m-binutils-2.35.1/bin/strip
stripping (with command strip and flags -S) in /nix/store/h8fhglmkzgnj4kwk308ifyfvxqynjs90-hello-2.10/bin 
patching script interpreter paths in /nix/store/h8fhglmkzgnj4kwk308ifyfvxqynjs90-hello-2.10
checking for references to /tmp/nix-build-hello-2.10.drv-0/ in /nix/store/h8fhglmkzgnj4kwk308ifyfvxqynjs90-hello-2.10...
copying 1 paths...
copying path '/nix/store/h8fhglmkzgnj4kwk308ifyfvxqynjs90-hello-2.10' from 'ssh://nix-docker'...
1 Like

Using the official LnL7/nix-docker setup script and then following the docs NixOS - Guides - Building and running Docker images works.

% source <(curl

% mkdir test
% cd $_
% cat > hello-docker.nix
{ pkgs ? import <nixpkgs> { system = "x86_64-linux"; } }:

pkgs.dockerTools.buildImage {
  name = "hello-docker";
  config = {
    Cmd = [ "${pkgs.hello}/bin/hello" ];

% nix-build hello-docker.nix
% docker load < result
% hash=$(docker image list | grep hello | awk '{print $2}')
% docker run -t hello-docker:$hash
Hello, world!