Skip to content

Commit

Permalink
ztp: Disable podman logging when extracting container data
Browse files Browse the repository at this point in the history
As described in containers/podman#13779,
podman by default logs all of a container's stdout in order to retain
info to make 'podman logs' work. But this extra copy of stdout can be
overrun and cause hangs when shipping large amounts of data through
stdout (as in the case when piping out a tar stream).  Changing the
instructions and documentation to add '--log-driver=none' to the podman
commandline disables this extra unneeded logging and prevents hangs.

Signed-off-by: Jim Ramsay <[email protected]>
Signed-off-by: Nishant Parekh <[email protected]>
  • Loading branch information
lack authored and nishant-parekh committed May 10, 2022
1 parent 59d73ee commit 544a85a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions ztp/resource-generator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ push: ## Push to registry ${REG_URL}

export: ## Copy resources from container image to out/ directory
mkdir -p out
podman run --rm ${IMAGE_NAME}:${VERSION} extract /home/ztp --tar | tar x -C out
podman run --rm --log-driver=none ${IMAGE_NAME}:${VERSION} extract /home/ztp --tar | tar x -C out
mkdir -p out/kustomize
podman run --rm ${IMAGE_NAME}:${VERSION} extract /kustomize --tar | tar x -C out/kustomize
podman run --rm --log-driver=none ${IMAGE_NAME}:${VERSION} extract /kustomize --tar | tar x -C out/kustomize

all: build export push
3 changes: 1 addition & 2 deletions ztp/resource-generator/entrypoints/extract
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ if [[ $1 == "-h" || $1 == "--help" || $1 == "help" ]]; then
echo
echo " Important: With podman, add '--log-driver=none' to prevent podman from hanging with large data sent to stdout,"
echo " and '--rm' to avoid creating unneeded persistent container image"
echo " podman run \$THIS_CONTAINER $(basename $0) /home/ztp --tar | tar -C ./out"
echo
echo " $(basename $0) srcPath dstPath"
echo " Export the given directory structure to the destination path (should be mounted as a container volume)"
echo " Example:"
echo " podman run \$THIS_CONTAINER -v ./out:/out:Z $(basename $0) /home/ztp /out"
echo " podman run --rm \$THIS_CONTAINER -v ./out:/out:Z $(basename $0) /home/ztp /out"
exit 1
fi

Expand Down

0 comments on commit 544a85a

Please sign in to comment.