After creating the image I can start it and observe that /tmp isn’t the desired drwxrwxrwx but rather dr-xr-xr-x and the non-root user can’t create dirs there:
I have no experience with building docker images through nix, but you’re setting wrong permissions on your /tmp.
The correct permissions for /tmp are:
$ LANG=C stat /tmp
File: /tmp
Size: 520 Blocks: 0 IO Block: 4096 directory
Access: (1777/drwxrwxrwt) Uid: ( 0/ root) Gid: ( 0/ root)
That small t instead of the last x is very important. Try chmod 1777 after creating your directory instead of ugo=…
It looks like the directory is created in the nix-store, which is always read-only.
I don’t know enough about the dockerTools to provide a good answer, but one work-around I can think of is defining a volume to be mounted at /tmp in the container.
Also using ECS, we should exchange ideas/solutions.
For this, i had luck with creating an entrypoint that did a lot of the setup that would allow builds in the container. I also wanted to avoid the QEMU build step.
This is basically a generic container, where if you feed it paths and cmds, will fetch them from any stores it knows about and can get to, then nix run's it. Kinda bypasses the normal docker mechanism. Then you can bind mount /nix to the host machine, and all the other containers on the machine share the store. (it’s why i’m making a non /nix environment with busybox)
Under what environment is extraCommands executed? What commands are available? And if I need to use a special command do I have to use ${package}/bin/command?