From f2786e17aec3c9ee0e3b85c945caa5425a928576 Mon Sep 17 00:00:00 2001 From: "Collin J. Doering" Date: Fri, 29 Dec 2023 12:03:48 -0500 Subject: [PATCH] Place /etc/passwd file inside the container for root user This is needed because ssh requires the user that runs it to exist in /etc/passwd. --- .gitignore | 1 + Dockerfile | 1 + Makefile | 8 ++++++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index ee73460..8d85c12 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *~ *.tar.gz +passwd diff --git a/Dockerfile b/Dockerfile index ed35597..eec3d85 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,7 @@ FROM scratch ADD guix-tarball-pack.tar.gz /guix-builder ADD links.tar.gz / +ADD passwd /etc/passwd VOLUME /var/guix/daemon-socket/socket /gnu/store /etc/ssl ENTRYPOINT ["/guix-builder/bin/bash"] diff --git a/Makefile b/Makefile index aea658f..1c96d2e 100644 --- a/Makefile +++ b/Makefile @@ -5,8 +5,12 @@ GUIX_MANIFEST_DEV := manifest-dev.scm TARBALL ?= guix-tarball-pack.tar.gz LINKS_TARBALL ?= links.tar.gz +PASSWD_FILE ?= passwd IMAGE_TAG ?= guix-builder +$(PASSWD_FILE): + echo 'root:x:0:0:root:/root:/bin/sh' > passwd + $(LINKS_TARBALL): ln -s /guix-builder/bin bin tar -czvf $@ bin @@ -17,7 +21,7 @@ $(TARBALL): @chmod +w $@ .PHONY: build -build: $(TARBALL) $(LINKS_TARBALL) +build: $(TARBALL) $(LINKS_TARBALL) $(PASSWD_FILE) @docker build -t $(IMAGE_TAG) . .PHONY: run @@ -36,4 +40,4 @@ shell: .PHONY: clean: - rm -r $(TARBALL) $(LINKS_TARBALL) + rm -r $(TARBALL) $(LINKS_TARBALL) $(PASSWD_FILE)