Skip to content

Ubuntu Container on macOS (Apple Container) as an Alternative Development Environment #129

Description

@shengwen-tw

Sharing my attempt to build an Ubuntu-based development environment for semu using Apple container on macOS.
This setup provides a lightweight Linux environment with GUI (Openbox + Tint2) access via VNC.

Image

1. Install Apple Container

Follow the official guide:
https://github.com/apple/container

2. Create and Run Ubuntu Container

container run -it \
  --name ubuntu \
  --cpus 11 \
  --memory 16g \
  -p 5901:5901 \
  --volume ${HOME}/container-data/ubuntu-home:/home \
  docker.io/library/ubuntu:24.04 \
  bash
container exec -it ubuntu /bin/bash

3. Install Basic Development Packages

apt-get update
apt-get install -y \
  git vim htop \
  python3 python3-pip npm \
  tigervnc-standalone-server tigervnc-common \
  openbox lxterminal \
  iproute2 net-tools procps \
  python3-venv python3-tk tint2 \
  file wget cpio unzip rsync bc device-tree-compiler curl flex

4. Fix UTF-8 / Locale Issues (VNC Environment)

apt-get install -y \
  locales \
  language-pack-en \
  fonts-dejavu \
  fonts-liberation \
  fonts-noto \
  fonts-noto-cjk \
  fonts-noto-color-emoji \
  fontconfig

locale-gen en_US.UTF-8
update-locale LANG=en_US.UTF-8

cat <<'EOF' >> ~/.bashrc
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
EOF

5. Configure VNC Startup

mkdir -p /home/.vnc

cat > /home/.vnc/xstartup <<'EOF'
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS

xsetroot -solid '#2E2E2E' &

(sleep 2 && /usr/bin/tint2) &

exec /usr/bin/openbox
EOF

chmod +x /home/.vnc/xstartup

6. Add VNC Start Script

cat <<'EOF' > ~/start_vnc.sh
vncserver :1 -geometry 1920x1080 -depth 24 -localhost no -xstartup /home/.vnc/xstartup
EOF

chmod +x ~/start_vnc.sh

7. Set VNC Password

vncpasswd

8. Start VNC Server

~/start_vnc.sh

9. Connect via VNC Viewer

127.0.0.1:5901

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions