Building the Dockerfile without having nix installed (inside docker) Starting the Docker container docker run -it --rm -v "$(pwd):/app" nixos/nix Enable flakes echo 'experimental-features = nix-command flakes' >> /etc/nix/nix.conf Switch to app directory cd /app Build the binary nix build .#bin Copy the binary to the output folder cp -r $(readlink -f result) output Build the Docker image nix build .#dockerImage Copy the Docker image to the output folder cp $(readlink -f result) output/docker-image.tar.gz Importing the nix-built image into docker docker load -i output/docker-image.tar.gz