~mcepl/moldavite#17: 
Running sway in a distrobox container

Status
REPORTED
Submitter
~mcepl
Assigned to
No-one
Submitted
9 months ago
Updated
9 months ago
Labels
No labels applied.

~mcepl 9 months ago

GrabbenD’s script is:

build_args=(
  # Reuse host cache
  --volume /var/cache/pacman/pkg:/var/cache/pacman/pkg:rslave
  # Config files
  --volume /home:/home:rslave
)

run_args=(
  --name='game'

  # Support /sbin/init
  --systemd=always
  --volume /sys/fs/cgroup:/sys/fs/cgroup:ro

  # Detect file changes in Containerfile
  --rm='true'
  --replace='true'

  # Bridge network
  --network='host'

  # GPU access
  --privileged='true'
  --ipc='host'
  --device /dev/dri:/dev/dri:rwm
  --device /dev/fb0:/dev/fb0:rwm
  --volume /dev/shm:/dev/shm:rslave

  # Seats
  --volume /dev/tty0:/dev/tty0:rslave
  --volume /dev/tty1:/dev/tty1:rslave

  # SELinux
  --security-opt seccomp=unconfined
  --security-opt unmask=/sys/dev

  # Peripherals
  --volume /dev/input:/dev/input
  --volume /run/udev:/run/udev:rslave
  --volume /dev/snd:/dev/snd:rslave
)

# CTRL+P+Q to quit
clear && \
  sudo podman build \
    "${build_args[@]}" \
    -t local/game:latest \
    -f Containerfile.game \
    "$@" \
    ./ && \
  sudo podman run \
    "${run_args[@]}" \
    "${build_args[@]}" \
    -d \
    local/game:latest && \
  systemctl stop \
    getty@tty1.service && \
  sudo podman exec \
    -it game \
    /bin/login
Register here or Log in to comment, or comment via email.