Skip to content

"Out of Memory" in Docker preview guest on M1 Mac Mini #4485

Closed
@spease

Description

Describe the bug

All the nix commands I've tried with both the docker LnL7/nix and nixos/nix images fail with out of memory errors using the Docker Preview on an M1 Mac Mini.

EDIT: Note that while my examples show me mounting the CWD to /nixpkgs, this is not necessary to reproduce the bug. Either of these commands will have the same issue without the volume mount:

docker run -it nixos/nix nix-env --version
docker run -it nixos/nix nix eval "(import <nixpkgs> {}).lib.version"
docker run -it lnl7/nix nix eval "(import <nixpkgs> {}).lib.version"
docker run lnl7/nix nix eval "(import <nixpkgs> {}).lib.version"
docker run nixos/nix nix eval "(import <nixpkgs> {}).lib.version"

Steps To Reproduce

Install the current Docker M1 Tech Preview:
https://docs.docker.com/docker-for-mac/apple-m1/
https://desktop.docker.com/mac/m1preview/Docker-AppleSilicon-Preview7.dmg

Execute this command:

docker run -v $(pwd):/nixpkgs -it nixos/nix nix eval "(import <nixpkgs> {}).lib.version"

You'll see:

WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
GC Warning: Failed to expand heap by 402653184 bytes
GC Warning: Failed to expand heap by 557056 bytes
GC Warning: Failed to expand heap by 294912 bytes
GC Warning: Out of Memory! Heap size: 0 MiB. Returning NULL!
error: out of memory

You can try increasing the memory, but I got the same error up to 6gb.

Expected behavior

"21.03pre266259.2fcf614ea38"

nix-env --version output

$ docker run -v $(pwd):/nixpkgs -m 1gb -it nixos/nix nix-env --version                              ~/Projects/nixpkgs
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
GC Warning: Failed to expand heap by 402653184 bytes
nix-env (Nix) 2.3.10

Additional context

My suspicion is that there is an underlying docker issue, but I still felt it was worth officially documenting it.

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions