mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Fix for gvisor-builder image.
As it happens gvisor/tools/bazel.mk:88 useradd --uid $(UID) --non-unique --no-create-home \ adds the user-id to /var/log/lastlog which happens to be a sparse file except Go's tar support can't handle sparse files so it actually tries to allocate the file to seek to the end causing the VM to run out of disk space. See: https://github.com/moby/moby/issues/5419#issuecomment-193876183 The fix is to pass -l to useradd to prevent it from trying to add to lastlog. Fixes #3397 PiperOrigin-RevId: 323492591
This commit is contained in:
committed by
gVisor bot
parent
18c2463596
commit
4d076ec152
+6
-1
@@ -79,13 +79,18 @@ ifneq (,$(BAZEL_CONFIG))
|
||||
OPTIONS += --config=$(BAZEL_CONFIG)
|
||||
endif
|
||||
|
||||
# NOTE: we pass -l to useradd below because otherwise you can hit a bug
|
||||
# best described here:
|
||||
# https://github.com/moby/moby/issues/5419#issuecomment-193876183
|
||||
# TLDR; trying to add to /var/log/lastlog (sparse file) runs the machine out
|
||||
# out of disk space.
|
||||
bazel-image: load-default
|
||||
@if docker ps --all | grep $(BUILDER_NAME); then docker rm -f $(BUILDER_NAME); fi
|
||||
docker run --user 0:0 --entrypoint "" --name $(BUILDER_NAME) \
|
||||
$(BUILDER_BASE) \
|
||||
sh -c "groupadd --gid $(GID) --non-unique $(USER) && \
|
||||
$(GROUPADD_DOCKER) \
|
||||
useradd --uid $(UID) --non-unique --no-create-home \
|
||||
useradd -l --uid $(UID) --non-unique --no-create-home \
|
||||
--gid $(GID) $(USERADD_OPTIONS) -d $(HOME) $(USER) && \
|
||||
if [[ -e /dev/kvm ]]; then chmod a+rw /dev/kvm; fi"
|
||||
docker commit $(BUILDER_NAME) $(BUILDER_IMAGE)
|
||||
|
||||
Reference in New Issue
Block a user