-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Notes #2
Comments
Troubleshootpodman unshare cat /proc/self/uid_map Refs.: podman unshare cat /proc/self/uid_map | wc --lines | rg 2 Refs.: podman unshare env podman unshare cat /proc/self/mountinfo TODO: make tests with the podman \
unshare \
strace \
--no-abbrev \
--string-limit=4096 \
--follow-forks \
--output=log-strace.txt \
podman \
run \
--log-level=debug \
--rm=true \
--interactive=true \
--tty=true \
docker.io/busybox \
echo 'Hello World!' From: containers/podman#7004 (comment) nix shell nixpkgs#util-linux
findmnt --submounts /sys/fs/cgroup nix shell nixpkgs#libselinux
getsebool container_manage_cgroup selinuxenabled; echo $? setsebool -P container_manage_cgroup 1 From: 4.2. Starting services within a container using systemd TODO: https://github.com/containers/podman/blob/main/contrib/podmanimage/stable/Dockerfile capsh --print From: containers/podman#6667 (comment) sh-5.0# echo podman:10000:65536 > /etc/subuid
sh-5.0# echo podman:10000:65536 > /etc/subgid From: containers/podman#6667 (comment) About the [engine]
events_logger = "file" From: containers/podman#4325 (comment) We need
The error
if unshare.IsRootless() {
flags = fmt.Sprintf("%s,userxattr", flags)
} containers/storage#863 (comment)
opts = fmt.Sprintf("%s,userxattr", opts)
Adapted and works:
containers/buildah#1304 (comment) and containers/podman#2659 (comment) /home/tobwen/podman/usr/local/bin/podman \
--log-level=debug \
--tmpdir /tmp/user/1000/libpod/tmp \
--conmon /home/tobwen/podman/usr/local/bin/conmon \
--network-cmd-path /home/tobwen/podman/usr/local/bin/slirp4netns \
--runtime /home/tobwen/podman/usr/local/bin/runc \
--storage-driver overlay \
--storage-opt "overlay.mount_program=/home/tobwen/podman/usr/local/bin/fuse-overlayfs" \
run \
hello-world |
stat /dev/kvm
file /dev/kvm
groups
sudo su -c 'groups'
podman run alpine ls /dev
podman run --privileged alpine ls /dev
id -u
stat -c "%U" $(tty)
sudo usermod -a -G kvm $(stat -c "%U" $(tty)) https://askubuntu.com/a/1187716, https://askubuntu.com/a/136804, https://askubuntu.com/a/739132, https://unix.stackexchange.com/a/145751 nix \
shell \
nixpkgs/84aa23742f6c72501f9cc209f29c438766f5352d#podman \
--command \
podman \
run \
--privileged=true \
--device=/dev/fuse \
--device=/dev/kvm \
--env=DISPLAY=':0.0' \
--interactive=true \
--network=host \
--mount=type=tmpfs,destination=/var/lib/containers \
--tty=true \
--rm=true \
--user=0 \
--volume=/tmp/.X11-unix:/tmp/.X11-unix:ro \
--volume=/etc/localtime:/etc/localtime:ro \
docker.nix-community.org/nixpkgs/nix-flakes
nix shell nixpkgs#{qemu,binutils,file,shadow,which,ripgrep}
nix build github:ES-Nix/nix-qemu-kvm/dev#qemu.prepare sudo chown $(id -u):$(id -g) /dev/kvm Reboot https://stackoverflow.com/a/64216394 cat /proc/modules | rg -c kvm sudo chown -R $(id -u):$(id -g) /dev/pts /dev/ptmx rkt/rkt#2152 (comment) nix \
shell \
nixpkgs/84aa23742f6c72501f9cc209f29c438766f5352d#podman \
--command \
podman \
run \
--privileged=true \
--device=/dev/fuse \
--device=/dev/kvm \
--env=DISPLAY=':0.0' \
--interactive=true \
--network=host \
--mount=type=tmpfs,destination=/var/lib/containers \
--tty=true \
--rm=true \
--user=0 \
--volume=/tmp/.X11-unix:/tmp/.X11-unix:ro \
--volume=/etc/localtime:/etc/localtime:ro \
--volume=/dev:/dev \
docker.nix-community.org/nixpkgs/nix-flakes nix \
shell \
nixpkgs/84aa23742f6c72501f9cc209f29c438766f5352d#podman \
--command \
podman \
run \
--privileged=true \
--env=DISPLAY=':0.0' \
--interactive=true \
--network=host \
--mount=type=tmpfs,destination=/var/lib/containers \
--tty=true \
--rm=true \
--security-opt=seccomp=unconfined \
--user=0 \
--volume=/tmp/.X11-unix:/tmp/.X11-unix:ro \
--volume=/etc/localtime:/etc/localtime:ro \
--volume=/dev/kvm:/dev/kvm:rw \
docker.nix-community.org/nixpkgs/nix-flakes stat /dev/kvm
nix shell nixpkgs#findutils --command find /dev -gid 65534 nix shell nixpkgs#{strace,which,ripgrep}
strace -o strace.out -f nix build github:ES-Nix/nix-qemu-kvm/dev#qemu.prepare
cat strace.out | rg -C 10 'Permission denied' https://stackoverflow.com/questions/32416409/getting-more-info-on-permission-denied mkdir -p ~/.config/containers
cat << 'EOF' >> ~/.config/containers/policy.json
{
"default": [
{
"type": "insecureAcceptAnything"
}
],
"transports":
{
"docker-daemon":
{
"": [{"type":"insecureAcceptAnything"}]
}
}
}
EOF
mkdir -p ~/.config/containers
cat << 'EOF' >> ~/.config/containers/registries.conf
[registries.search]
registries = ['docker.io']
[registries.block]
registries = []
EOF nix build nixpkgs/84aa23742f6c72501f9cc209f29c438766f5352d#podman
sudo su
mkdir -p /etc/containers
cat << 'EOF' >> /etc/containers/policy.json
{
"default": [
{
"type": "insecureAcceptAnything"
}
],
"transports":
{
"docker-daemon":
{
"": [{"type":"insecureAcceptAnything"}]
}
}
}
EOF sudo \
result/bin/podman \
run \
--privileged=true \
--env=DISPLAY=':0.0' \
--interactive=true \
--network=host \
--mount=type=tmpfs,destination=/var/lib/containers \
--tty=true \
--rm=true \
--security-opt=seccomp=unconfined \
--user=0 \
--volume=/tmp/.X11-unix:/tmp/.X11-unix:ro \
--volume=/etc/localtime:/etc/localtime:ro \
--volume=/dev/kvm:/dev/kvm:rw \
docker.nix-community.org/nixpkgs/nix-flakes Refs
|
Using podman from nix with flakes and test non-ASCII characterspodman \
run \
--interactive=true \
--tty=false \
--rm=true \
--user=0 \
docker.io/nixpkgs/nix-flakes \
<< COMMANDS
echo naïve café
COMMANDS Executing in interactive modepodman \
run \
--interactive=true \
--tty=true \
--rm=true \
--user=0 \
docker.io/nixpkgs/nix-flakes echo naïve café |
nix \
profile \
install \
github:ES-Nix/podman-rootless/from-nixpkgs nix \
build \
github:ES-Nix/podman-rootless/from-nixpkgs \
&& echo 'Build 1 finished!' \
&& result/bin/podman \
run \
--log-level=debug \
--privileged=true \
--device=/dev/fuse \
--device=/dev/kvm \
--env="DISPLAY=${DISPLAY:-:0.0}" \
--interactive=true \
--network=host \
--mount=type=tmpfs,destination=/var/lib/containers \
--tty=false \
--rm=true \
--user=0 \
--volume=/tmp/.X11-unix:/tmp/.X11-unix:ro \
--volume=/etc/localtime:/etc/localtime:ro \
docker.nix-community.org/nixpkgs/nix-flakes \
<<COMMANDS
mkdir --parent --mode=0755 ~/.config/nix
echo 'experimental-features = nix-command flakes ca-references ca-derivations' >> ~/.config/nix/nix.conf
nix \
build \
github:ES-Nix/podman-rootless/from-nixpkgs \
&& echo 'Build 2 finished!' \
&& result/bin/podman \
--log-level=debug \
images
COMMANDS nix \
build \
github:ES-Nix/podman-rootless/from-nixpkgs \
&& echo 'Build 1 finished!' \
&& result/bin/podman \
run \
--log-level=debug \
--privileged=true \
--device=/dev/fuse \
--device=/dev/kvm \
--env="DISPLAY=${DISPLAY:-:0.0}" \
--interactive=true \
--network=host \
--mount=type=tmpfs,destination=/var/lib/containers \
--tty=false \
--rm=true \
--user=0 \
--volume=/tmp/.X11-unix:/tmp/.X11-unix:ro \
--volume=/etc/localtime:/etc/localtime:ro \
docker.nix-community.org/nixpkgs/nix-flakes \
<<COMMANDS
mkdir --parent --mode=755 ~/.config/nix && touch ~/.config/nix/nix.conf
echo 'experimental-features = nix-command flakes ca-references ca-derivations' >> ~/.config/nix/nix.conf
nix \
build \
github:ES-Nix/podman-rootless/from-nixpkgs \
&& echo 'Build 2 finished!' \
&& result/bin/podman \
--log-level=debug \
pull \
docker.io/library/alpine:3.13.5
COMMANDS nix \
build \
github:ES-Nix/podman-rootless/from-nixpkgs \
&& echo 'Build 1 finished!' \
&& result/bin/podman \
run \
--log-level=debug \
--privileged=true \
--device=/dev/fuse \
--device=/dev/kvm \
--env="DISPLAY=${DISPLAY:-:0.0}" \
--interactive=true \
--network=host \
--mount=type=tmpfs,destination=/var/lib/containers \
--tty=false \
--rm=true \
--user=0 \
--volume=/tmp/.X11-unix:/tmp/.X11-unix:ro \
--volume=/etc/localtime:/etc/localtime:ro \
docker.nix-community.org/nixpkgs/nix-flakes \
<<COMMANDS
mkdir --parent --mode=755 ~/.config/nix && touch ~/.config/nix/nix.conf
echo 'experimental-features = nix-command flakes ca-references ca-derivations' >> ~/.config/nix/nix.conf
nix \
build \
github:ES-Nix/podman-rootless/from-nixpkgs \
&& echo 'Build 2 finished!' \
&& result/bin/podman \
--log-level=debug \
run \
--log-level=debug \
--interactive=true \
--tty=true \
--rm=true \
docker.io/library/alpine:3.13.5 \
sh \
-c \
'id'
COMMANDS |
podman \
run \
--env=PATH=/root/.nix-profile/bin:/usr/bin:/bin \
--device=/dev/kvm \
--device=/dev/fuse \
--env="DISPLAY=${DISPLAY:-:0.0}" \
--interactive=true \
--log-level=error \
--network=host \
--mount=type=tmpfs,destination=/var/lib/containers \
--privileged=true \
--tty=true \
--rm=true \
--userns=host \
--user=0 \
--volume=/etc/localtime:/etc/localtime:ro \
--volume=/sys/fs/cgroup:/sys/fs/cgroup:ro \
--volume=/tmp/.X11-unix:/tmp/.X11-unix:ro \
docker.nix-community.org/nixpkgs/nix-flakes mkdir --parent --mode=0755 ~/.config/nix
echo 'experimental-features = nix-command flakes ca-references ca-derivations' >> ~/.config/nix/nix.conf
mkdir --parent --mode=1777 /var/tmp nix store gc
du -s /nix/store/
nix profile install nixpkgs#hello
hello
du -s /nix/store/
nix store gc
du -s /nix/store/
nix profile install nixpkgs#hello
hello
du -s /nix/store/
nix store gc
du -s /nix/store/ podman \
run \
--env=PATH=/root/.nix-profile/bin:/usr/bin:/bin \
--device=/dev/kvm \
--device=/dev/fuse \
--env="DISPLAY=${DISPLAY:-:0.0}" \
--interactive=true \
--log-level=error \
--network=host \
--mount=type=tmpfs,destination=/var/lib/containers \
--privileged=true \
--tty=false \
--rm=true \
--userns=host \
--user=0 \
--volume=/etc/localtime:/etc/localtime:ro \
--volume=/sys/fs/cgroup:/sys/fs/cgroup:ro \
--volume=/tmp/.X11-unix:/tmp/.X11-unix:ro \
docker.nix-community.org/nixpkgs/nix-flakes \
<<COMMANDS
mkdir --parent --mode=0755 ~/.config/nix
echo 'experimental-features = nix-command flakes ca-references ca-derivations' >> ~/.config/nix/nix.conf
mkdir --parent --mode=1777 /var/tmp
nix \
profile \
install \
github:ES-Nix/podman-rootless/from-nixpkgs \
&& podman \
run \
--storage-driver="vfs" \
--cgroups=disabled \
--log-level=error \
--interactive=true \
--network=host \
--tty=true \
alpine \
sh \
-c 'apk add --no-cache curl && echo PinP'
COMMANDS |
3 Levels of nesting podman PinPinPpodman \
run \
--env=PATH=/root/.nix-profile/bin:/usr/bin:/bin \
--events-backend=file \
--device=/dev/kvm \
--device=/dev/fuse \
--env="DISPLAY=${DISPLAY:-:0.0}" \
--interactive=true \
--log-level=error \
--network=host \
--mount=type=tmpfs,destination=/var/lib/containers \
--privileged=true \
--tty=false \
--rm=true \
--user=0 \
--volume=/etc/localtime:/etc/localtime:ro \
--volume=/sys/fs/cgroup:/sys/fs/cgroup:ro \
--volume=/tmp/.X11-unix:/tmp/.X11-unix:ro \
docker.nix-community.org/nixpkgs/nix-flakes \
<<COMMANDS
mkdir --parent --mode=755 ~/.config/nix
echo 'experimental-features = nix-command flakes ca-references ca-derivations' >> ~/.config/nix/nix.conf
nix \
profile \
install \
github:ES-Nix/podman-rootless/from-nixpkgs \
&& mkdir -p -m 0755 /var/tmp \
&& podman \
run \
--cgroups=disabled \
--env=PATH=/root/.nix-profile/bin:/usr/bin:/bin \
--events-backend=file \
--env="DISPLAY=${DISPLAY:-:0.0}" \
--interactive=true \
--log-level=error \
--network=host \
--privileged=true \
--tty=false \
--rm=true \
--user=0 \
--volume=/sys/fs/cgroup:/sys/fs/cgroup:rw \
docker.nix-community.org/nixpkgs/nix-flakes \
<<COMMANDSNESTED
mkdir --parent --mode=0755 ~/.config/nix
echo 'experimental-features = nix-command flakes ca-references ca-derivations' >> ~/.config/nix/nix.conf
nix \
profile \
install \
github:ES-Nix/podman-rootless/from-nixpkgs \
&& mkdir --parent --mode=0755 /var/tmp \
&& podman \
run \
--events-backend=file \
--storage-driver="vfs" \
--cgroups=disabled \
--log-level=error \
--interactive=true \
--network=host \
--tty=true \
docker.io/library/alpine:3.14.0 \
sh \
-c 'apk add --no-cache curl && echo PinPinP'
COMMANDSNESTED
COMMANDS podman \
run \
--env=PATH=/root/.nix-profile/bin:/usr/bin:/bin \
--events-backend=file \
--device=/dev/kvm \
--device=/dev/fuse \
--env="DISPLAY=${DISPLAY:-:0.0}" \
--interactive=true \
--log-level=error \
--network=host \
--mount=type=tmpfs,destination=/var/lib/containers \
--privileged=true \
--tty=false \
--rm=true \
--user=0 \
--volume=/etc/localtime:/etc/localtime:ro \
--volume=/sys/fs/cgroup:/sys/fs/cgroup:ro \
--volume=/tmp/.X11-unix:/tmp/.X11-unix:ro \
docker.nix-community.org/nixpkgs/nix-flakes \
<<COMMANDS
mkdir --parent --mode=755 ~/.config/nix
echo 'experimental-features = nix-command flakes ca-references ca-derivations' >> ~/.config/nix/nix.conf
nix \
profile \
install \
github:ES-Nix/podman-rootless/from-nixpkgs \
&& mkdir -p -m 0755 /var/tmp \
&& podman \
--privileged=true \
run \
quay.io/podman/stable \
podman \
run \
--storage-driver="vfs" \
--cgroups=disabled \
ubi8 \
echo \
hello
COMMANDS |
Some notes
Jessie Frazelle:
List:
Cuts:
Texts:
https://jupyter-docker-stacks.readthedocs.io/en/latest/using/selecting.html#image-relationships
Texts:
The distroless thing
List:
TODO:
export TMP=/tmp
to solve the file system size problem? Ifexport TMPDIR=/tmp
is used, does the file system size problem still happening?TODO: Podman in Podman, similar to Docker in Docker?. Related: Daniel Walsh in Is there any chance to run rootless podman container inside another one? "Rootless podman inside of rootless podman, would be very difficult to make work,because of the multiple user namespaces." Related: Red Hat YouTube official channel video, Podman in Podman (Running a Container Within a Container)
TODO: add transcript and explain that for me it is valid to development environments/reproducible environments.
Object Oriented Programming vs Functional Programming
How to wrap setcap/setuid?
From: https://github.com/NixOS/nixpkgs/blob/nixos-20.09/pkgs/os-specific/linux/libcap-ng/default.nix#L34 and https://people.redhat.com/sgrubb/libcap-ng/
💡 reproduce CVEs using this.
Minimum required kernel version
May 21, 2011: 1 of 5 Dan Walsh, Red Hat, on SELinux security at the RHTUGNL, about history
Nix Cookbook
TODO: podman has this roles somewhere, find it and maybe make a PR correcting it
https://github.com/NixOS/nixpkgs/blob/2553aee74fed8c2205a4aeb3ffd206ca14ede60f/nixos/modules/services/cluster/kubernetes/default.nix#L281-L285
podman run docker.io/library/alpine:3.18.3 sh -c "cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 20 | head -n 9999"
The text was updated successfully, but these errors were encountered: